Example #1
0
        public ActionResult EditShow(ShowModel show)
        {
            var update = showService.UpdateShow(show);

            if (!update)
            {
                TempData["error"] = "There is a show that day";

                return(View());
            }

            return(RedirectToAction("Shows"));
        }
Example #2
0
        public IHttpActionResult Put(ShowEdit show)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ShowService service = CreateShowService();

            if (!service.UpdateShow(show))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Example #3
0
        public ActionResult Edit(int id, ShowEdit model)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Could not update show, try again later");
                return(View(model));
            }

            if (model.Id != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
            }

            ShowService service = new ShowService();

            if (service.UpdateShow(model))
            {
                return(RedirectToAction("AllShows"));
            }

            ModelState.AddModelError("", "Could not update show, try again later");
            return(View(model));
        }