Example #1
0
        public async Task <ActionResult> CreateClient(CreateClientViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    await service.CreateClient(model, GetUserId(), GetUsername());

                    return(RedirectToAction("Index"));
                }
                catch (ValidationException ve)
                {
                    ModelState.AddModelError("", ve.Message);
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("", "Something went wrong. Contact your administrator.");
                }
            }

            return(View(model));
        }