public IActionResult SavePrice(int id, EventPriceViewModel currentPrice, string returnUrl) { ViewBag.ReturnUrl = returnUrl; var model = _eventService.GetSingle(id); if (model == null) { return(NotFound()); } if (!ModelState.IsValid) { model.CurrentPrice = currentPrice; return(View("EditEvent", model)); } var ok = true; if (currentPrice.Id.HasValue) { ok = _eventService.UpdatePrice(id, currentPrice); } else { _eventService.AddPrice(id, currentPrice); } if (!ok) { return(NotFound()); } if (!string.IsNullOrEmpty(returnUrl)) { return(Redirect(returnUrl)); } return(View("EditEvent", _eventService.GetSingle(id))); }