Пример #1
0
        public async Task <IActionResult> PostAsync([FromBody] CoordinateList value)
        {
            if (!ModelState.IsValid || value == null)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            var validator        = new CoordinateListValidator();
            var validationResult = validator.Validate(value);

            if (!validationResult.IsValid)
            {
                return(new BadRequestObjectResult(MapValidationResultToModelState(validationResult)));
            }

            var result = await _service.SaveList(value.ToCoordinateListEntity(0)).ConfigureAwait(false);

            return(new ObjectResult(result.ToCoordinateListDto()));
        }