public static void Delete(int id) { using (CinemaContext db = new CinemaContext()) { Telephone telephone = db.Telephones.Find(id); db.Telephones.Remove(telephone); db.SaveChanges(); } }
public static void Update(int id, int clentid, int number) { using (CinemaContext db = new CinemaContext()) { Telephone telephone = db.Telephones.Find(id); telephone.ClientId = clentid; telephone.Number = number; db.Telephones.Update(telephone); db.SaveChanges(); } }
public static void Insert(int id, int clentid, int number) { using (CinemaContext db = new CinemaContext()) { Telephone telephone = new Telephone(); telephone.Id = id; telephone.ClientId = clentid; telephone.Number = number; db.Telephones.Add(telephone); db.SaveChanges(); } }