Пример #1
0
        public async Task <IActionResult> Create(CreateCostRequest request)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var newCost = mapper.Map <Cost>(request);
                    var costId  = await costService.CreateAsync(newCost);

                    return(Ok(new CreateCostResponse {
                        Id = costId
                    }));
                }

                return(BadRequest());
            }
            catch (Exception e)
            {
                return(ExceptionResult(e));
            }
        }