Exemple #1
0
        public IActionResult EventDetails(EventViewModel vm)
        {
            ViewBag.states = new SelectList(GetStates());

            if (!ModelState.IsValid)
            {
                return(View(vm));
            }
            if (_repository.UpdateEvent(vm))
            {
                //var x = _repository.SaveAll();
                if (_repository.SaveAll())
                {
                    return(RedirectToAction("Events"));
                }
                ModelState.AddModelError("", "There was an error while saving updated event to database");
                return(View(vm));
            }
            ModelState.AddModelError("", "There was an error while updating the event");
            return(View(vm));
        }