public async Task <ActionResult> OwnerDenyBid([FromBody] OwnerBidParamsDTO ownerBidParamsDTO) { if (string.IsNullOrWhiteSpace(ownerBidParamsDTO.Username)) { return(BadRequest("Invalid username")); } if (ownerBidParamsDTO.StoreId == Guid.Empty) { return(BadRequest("Invalid store ID")); } if (ownerBidParamsDTO.BidId == Guid.Empty) { return(BadRequest("Invalid bid ID")); } Result <bool>?result = await MarketBidsService.OwnerDenyBid ( ownerBidParamsDTO.Username, ownerBidParamsDTO.StoreId, ownerBidParamsDTO.BidId ); if (result == null || ((result.IsErr || !result.Ret) && string.IsNullOrWhiteSpace(result.Mess))) { return(InternalServerError()); } if (result.IsErr || !result.Ret) { return(InternalServerError(result.Mess)); } return(Ok()); }
public ActionResult <BidStoreDTO> OfStoreSpecific([FromBody] OwnerBidParamsDTO ownerBidParamsDTO) { // TODO: call a specific service layer function ActionResult actionResult = OfStoreCore ( ownerBidParamsDTO.StoreId, ownerBidParamsDTO.Username, bid => bid.Id == ownerBidParamsDTO.BidId, out IEnumerable <BidStoreDTO>?bids ); if (actionResult != null) { return(actionResult); } if (bids == null) { return(InternalServerError()); } BidStoreDTO?bid = null; try { bid = bids.SingleOrDefault(); } catch (InvalidOperationException) { } if (bid == null) { return(InternalServerError("More than 1 bids match the specified ID")); } return(Ok(bid)); }