コード例 #1
0
        public async Task <IActionResult> CreateLot([FromBody] LotCreateViewModel lotViewModel)
        {
            if (lotViewModel == null)
            {
                return(BadRequest(ModelState));
            }

            AddValidationErrors(lotViewModel);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var lot = _maper.Map <LotCreateViewModel, Lot>(lotViewModel);

            lot.AppUserID = User.FindFirstValue(ClaimTypes.NameIdentifier);

            await _lotService.CreateLotAsync(lot);

            return(Ok(lot));
        }