Hi @KALYANA ALLAM
asp.net core create image doesnt handle nulls. This scenario doesn't work, when I try to create a record without image.
Try to use F12 developer tools to debug your code, you can find that when create a record without image, the ModelState is invalid, so the insert command will not execute.
To solve this issue, try to change the parameter as nullable (IFormFile? image
).
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Visitid,Notes,Visitdate,Patientid,Clinicianid")] Visit visit, IFormFile? image)
{
Then, the result as below:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion