public IActionResult Create([FromBody] EditBidResource resource) { AppLogger.LogResourceRequest(nameof(Create), base.GetUsernameForRequest()); try { var result = _bidService.ValidateResource(resource); if (!result.IsValid) { GetErrorsForModelState(result.ErrorMessages); } if (ModelState.IsValid) { var bid = _bidService.Add(resource); return(CreatedAtAction(nameof(Create), bid)); } return(ValidationProblem()); } catch (Exception ex) { return(BadRequestExceptionHandler(ex, nameof(Create))); } }
public ValidationResult Add(Bid bid) { BeginTransaction(); var bidModel = bid.ToModel(); ValidationResult = _bidService.Add(bidModel).ToViewModel(); if (ValidationResult.IsValid) { Commit(); } return(ValidationResult); }
public void Post([FromBody] BidDto dto) { _bidService.Add(dto); }