Beispiel #1
0
        public async Task <Result <User> > CreateUser(Business.Entities.User user)
        {
            SetPassword(user);
            var userRepoObj = ObjectMapper.CreateMap(user);
            var result      = await _userRepo.CreateUser(userRepoObj);

            if (result.IsSuccessed)
            {
                return(Result.Ok(ObjectMapper.CreateMap(result.Value)));
            }
            return(Result.Fail <User>(result.GetErrorString()));
        }
Beispiel #2
0
 public static Repositories.Entities.User CreateMap(Business.Entities.User userBusinessObj)
 {
     if (userBusinessObj == null)
     {
         return(null);
     }
     return(new Repositories.Entities.User
     {
         Email = userBusinessObj.Email,
         Name = userBusinessObj.Name,
         RoleID = userBusinessObj.RoleID,
         UserID = userBusinessObj.UserID,
         UserName = userBusinessObj.UserName,
         PasswordHash = userBusinessObj.PasswordHash,
         PasswordSalt = userBusinessObj.PasswordSalt
     });
 }
Beispiel #3
0
        public async Task <Result> AssignUserToUntaggedUPC(int[] untaggedUPCIDs, Business.Entities.User user, int adminUserID)
        {
            if (untaggedUPCIDs.Length <= 0)
            {
                return(Result.Fail(Constants.Untagged_UPC_Group_Is_Empty));
            }

            else if (user?.UserID == default(int))
            {
                return(Result.Fail(Constants.Assignee_Details_Empty));
            }

            else if (!(await _userRepository.GetUser(user.UserID)).IsSuccessed)
            {
                return(Result.Fail(Constants.Assignee_Not_Found));
            }

            return(await _untagggedUPCRepo.AssignUserToUntaggedUPC(untaggedUPCIDs, ObjectMapper.CreateMap(user), adminUserID));
        }
Beispiel #4
0
 public ManageUserViewModel(User user)
 {
     this.guid = user.UserId;
     this.userName = user.UserName;
 }