コード例 #1
0
 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,
     });
 }
コード例 #2
0
        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 }));
            }
        }
コード例 #3
0
        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 }));
            }
        }
コード例 #4
0
ファイル: UserParamBlo.generated.cs プロジェクト: msynk/ef
 public int EditUserParam(UserParamDto dto)
 {
     return(Edit(UserParamDtoMapper.To(dto)));
 }
コード例 #5
0
ファイル: UserParamBlo.generated.cs プロジェクト: msynk/ef
 public int AddUserParam(UserParamDto dto)
 {
     return(Add(UserParamDtoMapper.To(dto)));
 }