Example #1
0
        void UpdateUser_NO_Service(User oldUser)
        {
            UpdateUserReq     req = new UpdateUserReq();
            UpdateUserService svc = new UpdateUserService();

            req.BusinessData.UsersBE = oldUser;

            req.BusinessData.UsersBE.FirstName        = oldUser.FirstName + "_updated";
            req.BusinessData.UsersBE.LastName         = oldUser.LastName + "_updated";
            req.BusinessData.UsersBE.ModifiedByUserId = 12;
            req.BusinessData.UsersBE.ModifiedDate     = System.DateTime.Now;
            req.BusinessData.UsersBE.Email            = oldUser.Email + ".ar";


            req.BusinessData.PasswordOnly = false;

            try
            {
                UpdateUserRes res = svc.Execute(req);
            }
            catch (Exception ex)
            {
                base.StrExceptionMessage = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex);
            }



            Assert.AreEqual <String>(base.StrExceptionMessage, String.Empty, base.StrExceptionMessage);
        }
Example #2
0
        void UpdateUser_cpass_NO_Service(User oldUser)
        {
            UpdateUserReq     req = new UpdateUserReq();
            UpdateUserService svc = new UpdateUserService();


            req.BusinessData.ChangePassword     = new ChangePassword();
            req.BusinessData.ChangePassword.New = "11111";
            req.BusinessData.ChangePassword.Old = "66666";
            req.BusinessData.UsersBE            = oldUser;


            req.BusinessData.PasswordOnly = true;

            try
            {
                UpdateUserRes res = svc.Execute(req);
            }
            catch (Exception ex)
            {
                base.StrExceptionMessage = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex);
            }



            Assert.AreEqual <String>(base.StrExceptionMessage, String.Empty, base.StrExceptionMessage);
        }
Example #3
0
 public UsersController(
     ShowUserService showUserService,
     AddUserService addUserService,
     UpdateUserService updateUserService,
     DeleteUserService deleteUserService)
 {
     _showUserService   = showUserService;
     _addUserService    = addUserService;
     _updateUserService = updateUserService;
     _deleteUserService = deleteUserService;
 }
Example #4
0
        Put([FromServices] UpdateUserService _update, int Id, [FromBody] User data)
        {
            try
            {
                if (Id != data.Id)
                {
                    return(BadRequest("Usuário inválido."));
                }
                var updatedUser = await _update.Execute(data);

                return(new UserView(updatedUser));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Example #5
0
        void UpdateUser_NO_Service(User oldUser)
        {

            UpdateUserReq req = new UpdateUserReq();
            UpdateUserService svc = new UpdateUserService();
    
            req.BusinessData.UsersBE = oldUser;

            req.BusinessData.UsersBE.FirstName = oldUser.FirstName + "_updated";
            req.BusinessData.UsersBE.LastName = oldUser.LastName + "_updated";
            req.BusinessData.UsersBE.ModifiedByUserId = 12;
            req.BusinessData.UsersBE.ModifiedDate = System.DateTime.Now;
            req.BusinessData.UsersBE.Email = oldUser.Email + ".ar";
   

            req.BusinessData.PasswordOnly = false;

            try
            {

                UpdateUserRes res = svc.Execute(req);

            }
            catch (Exception ex)
            {
                base.StrExceptionMessage = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex);
            }




            Assert.AreEqual<String>(base.StrExceptionMessage, String.Empty, base.StrExceptionMessage);
        }
Example #6
0
        void UpdateUser_cpass_NO_Service(User oldUser)
        {
          
            UpdateUserReq req = new UpdateUserReq();
            UpdateUserService svc = new UpdateUserService();
         

            req.BusinessData.ChangePassword = new ChangePassword();
            req.BusinessData.ChangePassword.New = "11111";
            req.BusinessData.ChangePassword.Old = "66666";
            req.BusinessData.UsersBE = oldUser;


            req.BusinessData.PasswordOnly = true;

            try
            {
 
                UpdateUserRes res = svc.Execute(req);
             
            }
            catch (Exception ex)
            {
                base.StrExceptionMessage = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex);
            }




            Assert.AreEqual<String>(base.StrExceptionMessage, String.Empty, base.StrExceptionMessage);
        }