ASP.NET MVC update
I have an Employee object that has an image property. The image class contains the image metadata as the image title and image file name.
If I upload a new image for an employee on an asynchronous path without a complete message, the new image doesn't appear on the page.
I am using GUID to refer to the image file to avoid page caching.
I am changing the image like this:
ctrEmployee employee = Repository.Get (PassedItemID);
if (employee.ctrImage != null)
{
string fullFileName = serverFolder + employee.ctrImage.FileName;
FileInfo TheFile = new FileInfo(fullFileName);
if (TheFile.Exists)
{
TheFile.Delete();
}
fileName = Guid.NewGuid() + ".jpg";
employee.ctrImage.FileName = fileName;
}
resizedBmp.Save(string.Format("{0}{1}", serverFolder, fileName), System.Drawing.Imaging.ImageFormat.Jpeg);
Repository.Edit<ctrEmployee>(employee);
ImageID = employee.Image.Value;
return PartialView(UserControlPaths.Thumbnail, new ThumbnailDataModel(employee.Image.Value, 150, 150));
Partial view has an image tag that gets the stored image url string which is the GUID.
Does anyone have an idea what I am doing wrong?
+2
a source to share