Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public ActionResult <UserView> Put(int id, [FromBody] User model)
 {
     try
     {
         var user = _updateUserService.Execute(id, model);
         return(Ok(new UserView(user)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }