Exemplo n.º 1
0
 public IActionResult Register(UserCreateModel userCreateModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var result = _userEngine.Create(userCreateModel);
             if (result.IsSuccess)
             {
                 AddNotification(NotifyType.Success, result.Message);
                 return(RedirectToAction("Index", "Home"));
             }
             else
             {
                 AddNotification(NotifyType.Error, result.Message);
                 return(View(userCreateModel));
             }
         }
         else
         {
             AddNotification(NotifyType.Warning, Keywords.ModelMustBeValid);
             return(View(userCreateModel));
         }
     }
     catch
     {
         AddNotification(NotifyType.Error, Keywords.CreateError);
         return(View(userCreateModel));
     }
 }