public long Insert(tbl_ImagePosts imagePosts) { imagePosts.Status = true; db.tbl_ImagePosts.Add(imagePosts); db.SaveChanges(); return(imagePosts.ID); }
public bool Update(tbl_ImagePosts imagePosts) { try { var entity = db.tbl_ImagePosts.Find(imagePosts.ID); entity.Images = imagePosts.Images; entity.Status = imagePosts.Status; entity.tbl_Posts.ID = imagePosts.tbl_Posts.ID; entity.AltForImage = imagePosts.AltForImage; db.SaveChanges(); return(true); } catch { return(false); } }