//Insert new person public string AddPerson(People p) { if (p != null) { using (DbForMODEntity dataContext = new DbForMODEntity()) { dataContext.P_InsertData(p.FirstName, p.LastName, p.BornDate); dataContext.SaveChanges(); return("Person Updated"); } } else { return("Invalid Person"); } }
//Delete person public string DeletePerson(People p) { if (p != null) { using (DbForMODEntity dataContext = new DbForMODEntity()) { int no = Convert.ToInt32(p.ID); var employeeList = dataContext.P_DeleteData(no); dataContext.SaveChanges(); return("Person Deleted"); } } else { return("Invalid Person"); } }
//Update person public string UpdatePerson(People p) { if (p != null) { using (DbForMODEntity dataContext = new DbForMODEntity()) { int no = Convert.ToInt32(p.ID); var employeeList = dataContext.P_UpdateData(no, p.FirstName, p.LastName, p.BornDate); dataContext.SaveChanges(); return("Person Updated"); } } else { return("Invalid Person"); } }