public void Add(Client client)
 {
     if (client != null && client.IsValid())
     {
         PerformCall(() => mCreateRepository.Create(client));
     }
 }
Ejemplo n.º 2
0
 public ActionResult Registration(UserRegister user)
 {
     if (user.IsValid())
     {
         var tempUser = Mapper.Map <UserRegister, User>(user);
         tempUser.RoleId = 2;
         PerformCall(() => mCreateRepository.Create(tempUser));
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
Ejemplo n.º 3
0
        public IResult <T> Create(T entity) => Do <T> .Try(r =>
        {
            var result = _createRepository.Create(entity);

            if (result.HasErrorsOrResultIsNull())
            {
                r.AddErrors(result.Errors);
                return(default(T));
            }

            return(result.ResultObject);
        }).Result;