public async Task <ICollection <LotRequest> > GetLotRequests(int lotId) { if (!await LotService.IsExist(lotId)) { throw new EntityNotFoundException($"LotId:{lotId} not found", "Lot"); } return(await Repository.GetByLot(lotId)); }
public async Task <LotRequest> GetCurrentRequest(int lotId, int dispatcherId) { if (!await LotService.IsExist(lotId)) { throw new EntityNotFoundException($"LotId:{lotId} not found", "Lot"); } if (!await DispatcherService.IsExist(dispatcherId)) { throw new EntityNotFoundException($"DispatcherId:{dispatcherId} not found", "Dispatcher"); } return(await Repository.GetCurrent(lotId, dispatcherId)); }
protected override async Task <bool> DoVerifyEntity(LotRequest entity) { if (!await LotService.IsExist(entity.LotId)) { throw new EntityNotFoundException($"Owner LotId:{entity.LotId} not found", "Lot"); } if (!await DispatcherService.IsExist(entity.DispatcherId)) { throw new EntityNotFoundException($"Owner DispatcherId:{entity.DispatcherId} not found", "Dispatcher"); } return(true); }
public async Task <bool> IsExistBet(int lotId, int dispatcherId) { if (!await LotService.IsExist(lotId)) { throw new EntityNotFoundException($"LotId:{lotId} not found", "Lot"); } if (!await DispatcherService.IsExist(dispatcherId)) { throw new EntityNotFoundException($"DispatcherId:{dispatcherId} not found", "Dispatcher"); } var currentRequest = await GetCurrentRequest(lotId, dispatcherId); return(currentRequest?.Status == LotRequestStatus.Bet); }
public async Task Trade(int orderId) { var lot = await LotService.GetByOrder(orderId); await LotService.Trade(lot.Id); var order = await OrderService.Get(orderId); var dispatchers = await DispatcherService.GetByCompany(order.CompanyId); var notify = new Notify( dispatchers, "Новый заказ", "Параметры нового заказа", NotificationChanelKind.All); await NotificationService.Notice(notify); }