public void Add(Review model) { using (var dbcontext = new ResturantDBEntities()) { dbcontext.Reviews.Add(model); dbcontext.SaveChanges(); } }
public void addResturant(Models.Resturant model) { using (var dbcontext = new ResturantDBEntities()) { dbcontext.Resturants.Add(ModelToData(model)); dbcontext.SaveChanges(); } }
public void Delete(Resturant model) { using (var dbcontext = new ResturantDBEntities()) { dbcontext.Resturants.Attach(model); dbcontext.Resturants.Remove(model); dbcontext.SaveChanges(); } }
public void Update(Review model) { using (var dbcontext = new ResturantDBEntities()) { foreach (var rev in dbcontext.Reviews) { if (rev.rv_id == model.rv_id) { rev.Author = model.Author; rev.Rating = model.Rating; rev.Comment = model.Comment; } } dbcontext.SaveChanges(); } }
public void Update(Resturant model) { using (var dbcontext = new ResturantDBEntities()) { foreach (var res in dbcontext.Resturants) { if (res.rs_id == model.rs_id) { res.Name = model.Name; res.Address = model.Address; res.City = model.City; res.State = model.State; res.FoodType = model.FoodType; break; } } dbcontext.SaveChanges(); } }