Esempio n. 1
0
        public async Task <IActionResult> UpdateProfile(int id, [FromBody] Models.UpdateUserRequest userInfo)
        {
            Entities.User user = null;
            try
            {
                user          = _mapper.Map <Entities.User>(userInfo);
                user.UserId   = id;
                user.Fullname = userInfo.Fullname;
                user.Email    = userInfo.Email;
                user.PhoneNo  = userInfo.PhoneNo;
                await _userBL.UpdateUser(user, id);

                return(Ok("success!!"));
            }
            catch (Exception e)
            {
                return(BadRequest(new { message = e.Message }));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> UpdateUser([FromBody] Models.UpdateUserRequest userInfo)
        {
            Entities.User user = null;
            try
            {
                var id = int.Parse(User.Claims.First(c => c.Type == "userID").Value);
                user          = _mapper.Map <Entities.User>(userInfo);
                user.UserId   = id;
                user.Fullname = userInfo.Fullname;
                user.Email    = userInfo.Email;
                user.PhoneNo  = userInfo.PhoneNo;
                await _userBL.UpdateUser(user, id);

                return(Ok("success!!"));
            }
            catch (Exception e)
            {
                return(BadRequest(new { message = e.Message }));
            }
        }