public bool Update(tb_Contact entity) { try { db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult Contactf(string FullName, string Email, string Content) { var entity = new tb_Contact(); entity.Date = DateTime.Now; entity.Modified = DateTime.Now; entity.FullName = FullName; entity.Email = Email; entity.Content = Content; long Id = Contacts.Insert(entity); return(Redirect("/")); }
public long Insert(tb_Contact entity) { db.tb_Contact.Add(entity); db.SaveChanges(); return(entity.Id); }