示例#1
0
        public IHttpActionResult Update(UserGetUpdateApiModel userApiModel)
        {
            if (userApiModel == null)
            {
                return(BadRequest());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var userParameters = new UserCommand.CreateOrEditParameters
            {
                Username         = userApiModel.Username,
                Lastname         = userApiModel.Lastname,
                Firstname        = userApiModel.Firstname,
                Email            = userApiModel.Email,
                EmailAlternative = userApiModel.EmailAlternative,
                InternalNumber   = userApiModel.InternalNumber,
                PhoneNumber      = userApiModel.PhoneNumber,
                MobileNumber     = userApiModel.MobileNumber
            };

            UserCommand.EditRegister(userParameters);

            return(Ok());
        }
示例#2
0
        public IHttpActionResult Get()
        {
            var user = UserCommand.Get(GetIdUserLogged());

            var userApiModel = new UserGetUpdateApiModel
            {
                Username         = user.Username,
                Firstname        = user.Firstname,
                Lastname         = user.Lastname,
                Email            = user.Email,
                EmailAlternative = user.EmailAlternative,
                InternalNumber   = user.InternalNumber,
                PhoneNumber      = user.PhoneNumber,
                MobileNumber     = user.MobileNumber
            };

            return(Ok(userApiModel));
        }