public bool AuthShipperSend(string CodeCabinet, IMqttClientMain mqttClientMain) { Cabinet cabinet = smartDeliveryContext.Cabinet.Where(x => x.Code.Equals(CodeCabinet)).FirstOrDefault(); cabinet.GoodsId = null; mqttClientMain.PublishToTopicAsync("command/locker1", "0"); return(true); }
public bool AuthShipperRecievie(Guid GoodsId, string CodeCabinet, IMqttClientMain mqttClientMain) { Cabinet cabinet = smartDeliveryContext.Cabinet.Where(x => x.Code.Equals(CodeCabinet)).FirstOrDefault(); Goods goods = smartDeliveryContext.Goods.Where(x => x.Id == GoodsId).FirstOrDefault(); cabinet.GoodsId = goods.Id; goods.Status = 5; mqttClientMain.PublishToTopicAsync("command/locker2", "0"); return(true); }
public bool CustomerSend(string CodeCabinet, UserEntity userEntity, IMqttClientMain mqttClientMain) { Cabinet cabinet = smartDeliveryContext.Cabinet.Where(x => x.Code.Equals(CodeCabinet)).FirstOrDefault(); Goods goods = smartDeliveryContext.Goods.Where(x => x.IdSender == userEntity.Id).FirstOrDefault(); if (goods != null) { if (cabinet.GoodsId == goods.Id) { //cabinet.IsOpended = true; smartDeliveryContext.SaveChanges(); mqttClientMain.PublishToTopicAsync("command/locker1", "0"); return(true); } else { return(false); } } return(false); }