public void DeleteRestaurantById(int id) { var orig = _repo.GetRestaurantById(id); _repo.Delete(orig); _repo.SaveChanges(); }
private void DeleteButton_Click(object sender, EventArgs e) { try { Restaurant restaurant = (Restaurant)bindingSourceRestaurant.Current; if (restaurant == null) { return; } DialogResult result = MessageBox.Show( InfoMessages.DeleteConfirmation, GlobalConstants.DeleteConfirmationCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { repository.Delete(restaurant); RefreshControls(); } } catch (Exception ex) { throw new ApplicationException(string.Format(ErrorMessages.ErrorMessageTemplate, RestaurantDisplay), ex); } }
public ActionResult Delete(RestaurantsDeleteViewModel model) { RestaurantRepository repository = new RestaurantRepository(); repository.Delete(model.ID); return(RedirectToAction("Index")); }
public void Delete_GivenRestaurant_RemovesRestaurant() { var restaurant = new Restaurant { RestaurantId = Guid.NewGuid(), RestaurantPublicId = Guid.NewGuid() }; _textContext.Restaurants.Add(restaurant); _textContext.SaveChanges(); _restaurantRepository.Delete(restaurant); Assert.IsFalse(_restaurantRepository.Get().Contains(restaurant)); }
public async Task <IHttpActionResult> Delete(string id) { if (id == null) { return(BadRequest("Id can not be null")); } try { var deleteRestaurant = _repository.Delete(id); return(Json(deleteRestaurant)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult DeleteConfirmed(int id) { try { Restaurant r = restaurantRepository.GetByID(id); if (r == null) { throw new ArgumentNullException("id"); } restaurantRepository.Delete(r); return(RedirectToAction("Index")); } catch (Exception e) { log.Error($"[Restaurants Controller] [Delete] Exception thrown: {e.Message}"); return(RedirectToAction("Index")); } }
public void DeleteRestaurant(int id) { restrepo.Delete(id); }
public bool Delete(Restaurant restodelete) { return(restRepo.Delete(restodelete)); }
public ActionResult Delete(int id) { restaurantRepository.Delete(id); return(RedirectToAction("TempDataResult")); }
public bool Delete(int id) { return(restaurantRepo.Delete(id)); }
public ActionResult DeleteConfirmed(int id) { rr.Delete(id); logger.Trace("Restuarant Deleted"); return(RedirectToAction("Index")); }
public bool DeleteRestaurant(string id) { return(restaurants.Delete(id)); }
public ActionResult Delete(int id) { RestaurantRepository.Delete(id); TempData["Message"] = "Deleted Succesfully"; return(RedirectToAction("Index")); }