public async Task <ActionResult <Quote> > PostQuote([FromBody] Quote quote)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var createQuote = await quotesService.CreateQuote(quote);

            return(Created($"/api/Quotes/{createQuote.Id}", createQuote));
        }
示例#2
0
 public ActionResult <Quote> CreateQuote(LoanRequest request)
 {
     try
     {
         var quote = _service.CreateQuote(_mapper.Map <Service.Model.LoanRequest>(request));
         return(CreatedAtRoute("GetQuote", new { Id = quote.Id }, _mapper.Map <Quote>(quote)));
     }
     catch (BusinessLogicException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (FluentValidation.ValidationException ex)
     {
         return(BadRequest(ex.Message));
     }
 }