/// <summary> /// Action to delete an itinerary by Id /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Delete(long id) { _itinerarysRepository = new ItinerarysRepository(); var res = _itinerarysRepository.Delete(id); if (res.Equals("NotAllowed")) { TempData["messageDelete"] = "The operation is not allowed because there are entries in the Tag Report"; } else if (res.Equals("Ok")) { TempData["messageDelete"] = "The Itinerary was successfully deleted"; } return(RedirectToAction("Index")); }
public ActionResult Delete(Itinerary model) { try { _itinerarysRepository = new ItinerarysRepository(); _bagTagDesignationRepository = new BagTagDesignationRepository(); _bagTagDesignationRepository.DeleteByItinerary(model.ItineraryID); _itinerarysRepository.Delete(model.ItineraryID); ViewBag.Message = "The itinerary with the Id {model.ItineraryID} was deleted from the Database"; return(View("messages")); } catch (Exception e) { ModelState.AddModelError("", e); ViewBag.Message = string.Format( "Error: an error occurred when tried to delete the itinerary with the ID {0} was not deleted from the Database", model.ItineraryID); return(View("messages")); } }