public async Task <IHttpActionResult> AcceptSellTransaction([FromBody] TransactionDto dto) { if (ModelState.IsValid == false) { return(BadRequest("Invalid data")); } if (dto.BuyOffer.BuyerId != (Thread.CurrentPrincipal as UserPrincipal).Id) { return(Unauthorized()); } var sellOffer = _sellAssembler.DtoToEntity(dto.SellOffer); var buyOffer = _buyAssembler.DtoToEntity(dto.BuyOffer); var rating = dto.Rating; var result = await _transactionService.AcceptSellTransaction(sellOffer, buyOffer, rating); if (result == ErrorValue.ServerError) { return(BadRequest("Transaction error")); } else if (result == ErrorValue.TransactionAlreadyFinished) { return(BadRequest("Transaction already finished")); } return(Ok()); }