public static UserParam To(UserParamDto dto) { return(new UserParam { Id = dto.Id, UserId = dto.UserId, Name = dto.Name, Value = dto.Value, User = dto.User != null?UserDtoMapper.To(dto.User) : null, }); }
public IActionResult Update(int id, [FromBody] UserParamDto model) { var user = _mapper.Map <User>(model); user.Id = id; try { _userService.Update(user, model.Password); return(Ok()); } catch (AppException ex) { return(BadRequest(new { message = ex.Message })); } }
public IActionResult Register([FromBody] UserParamDto model) { // map model to entity var user = _mapper.Map <User>(model); try { // create user _userService.Create(user, model.Password); return(Ok()); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(new { message = ex.Message })); } }
public int EditUserParam(UserParamDto dto) { return(Edit(UserParamDtoMapper.To(dto))); }
public int AddUserParam(UserParamDto dto) { return(Add(UserParamDtoMapper.To(dto))); }