public bool Create(DbFirst.Student model) { try { db.Students.Add(model); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool Update(DbFirst.Student model) { try { var existing = db.Students.Find(model.Id); if (existing == null) { return(false); } existing.Student1 = model.Student1; existing.Email = model.Email; existing.DOB = model.DOB; db.Entry(existing).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }