Exemplo n.º 1
0
        public ActionResult Create(OperatorViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    operatorService.AddOrUpdate(model);
                    return(RedirectToAction("Index")
                           .WithSuccess(string.Format("Operator \"{0} {1}\" has been added".TA(),
                                                      model.FirstName, model.LastName)));
                }
                catch (ArgumentException err)
                {
                    ModelState.AddModelError(err.ParamName ?? string.Empty, err.Message);
                }
            }

            return(View(model));
        }