// first save the edit data Actionresult Edit (Lot Lot) { remove scaffold code for clarity db.SaveChanges(); // create a new image to replace image currently in db. Bitmap mybmp = new Bitmap(400, 20); Graphics g = Graphics.FromImage(mybmp); g.DrawRectangle(Pens.Black, 0, 0, 400, 20); SolidBrush b = new SolidBrush(Color.OldLace); g.FillRectangle(b, 0, 0, 400, 20); // write a test file to confirm this is ok ------it works mybmp.Save("C:\\temp\\lot1.bmp",System.Drawing.Imaging.ImageFormat.Gif); // add code here to save image to Lot table field TaskImage here db.SaveChanges(); }
public class Lot { public int LotID { get; set; } public byte?[] TaskImage { get; set; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)