public IHttpActionResult DietDelete(int Id) { if (Id == 0) { return(BadRequest("Please enter a valid Diet Id. ")); } if (ModelState.IsValid) { var deleted = dietService.DeleteDiet(Id); if (deleted == true) { return(Ok()); } else { return(BadRequest("Your diet could not be deleted. Please try again. ")); } } return(BadRequest(ModelState)); }
public ActionResult Delete(int dietId) { _dietService.DeleteDiet(dietId); return(RedirectToAction("Index")); }