Esempio n. 1
0
        public Msg.User Map(Dom.User fromObject, Msg.User toObject = null)
        {
            var user = toObject ?? new Msg.User();

            user.DateOfBirth = fromObject.DateOfBirth;
            user.Firstname   = fromObject.Firstname;
            user.Id          = fromObject.Id;
            user.Surname     = fromObject.Surname;

            return(user);
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> UpdateUserAsync(int id, [FromBody] Dom.User user)
        {
            var repoUser = await _repositoryFacade.Users.GetUserByIdAsync(id);

            if (repoUser == null)
            {
                return(NotFound());
            }

            _mapper.Map <Dom.User, Repo.User>(user, repoUser);

            var success = await _repositoryFacade.Users.UpdateUserAsync(id, repoUser);

            if (!success)
            {
                return(InternalServerError());
            }

            return(Ok());
        }