public member GetClass(int id) { var db = new FamilyMembersManagementEntities(); var @class = db.members.Find(id); return(@class); }
public member[] GetClasses() { var db = new FamilyMembersManagementEntities(); var classes = db.members.ToArray(); return(classes); }
public void DeleteClass(int id) { var db = new FamilyMembersManagementEntities(); var @class = db.members.Find(id); db.members.Remove(@class); db.SaveChanges(); }
public void EditClass(int id, string fullname, string hometown, string currentliving, string occupation) { var db = new FamilyMembersManagementEntities(); var oldClass = db.members.Find(id); oldClass.fullname = fullname; oldClass.hometown = hometown; oldClass.living = currentliving; oldClass.occupation = occupation; db.Entry(oldClass).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void AddClass(string fullname, string hometown, string currentliving, string occupation) { var newClass = new member(); newClass.fullname = fullname; newClass.hometown = hometown; newClass.living = currentliving; newClass.occupation = occupation; var db = new FamilyMembersManagementEntities(); db.members.Add(newClass); db.SaveChanges(); }