public void Create(BaseEntity entity)
        {
            try
            {
                var nObj       = (User)entity;
                var resultId   = crudUser.Retrieve <User>(nObj);
                var resultUser = crudUser.RetrieveByUser <User>(nObj);

                if (resultId == null && resultUser == null)
                {
                    crudUser.Create(nObj);
                }
                else if (resultUser != null && nObj.UserName.Equals(resultUser.UserName))
                {
                    throw new BusinessException(5);
                }
                else if (resultId != null && nObj.Id.Equals(resultId.Id))
                {
                    throw new BusinessException(6);
                }
                else
                {
                    throw new BusinessException(3);
                }
            }
            catch (Exception error)
            {
                ExceptionManager.GetInstance().Process(error);
            }
        }
예제 #2
0
 public User RetrieveById(User user)
 {
     return(crudUser.Retrieve <User>(user));
 }