public static string Insert(int PostID, string Image, string CreatedBy, DateTime CreatedDate) { using (var dbe = new inventorymanagementEntities()) { tbl_PostImage ui = new tbl_PostImage(); ui.PostID = PostID; ui.Image = Image; ui.CreatedDate = CreatedDate; ui.CreatedBy = CreatedBy; dbe.tbl_PostImage.Add(ui); int kq = dbe.SaveChanges(); return(kq.ToString()); } }
public static tbl_PostImage GetByID(int ID) { using (var dbe = new inventorymanagementEntities()) { tbl_PostImage ai = dbe.tbl_PostImage.Where(a => a.ID == ID).SingleOrDefault(); if (ai != null) { return(ai); } else { return(null); } } }
public static string Update(int ID, string Image, string ModifiedBy, DateTime ModifiedDate) { using (var dbe = new inventorymanagementEntities()) { tbl_PostImage ui = dbe.tbl_PostImage.Where(a => a.ID == ID).SingleOrDefault(); if (ui != null) { ui.Image = Image; ui.ModifiedBy = ModifiedBy; ui.ModifiedDate = ModifiedDate; int kq = dbe.SaveChanges(); return(kq.ToString()); } else { return(null); } } }