Exemplo n.º 1
0
 public int BuyFood([FromBody] FoodDTO food)
 {
     try
     {
         var currentUserId = userManager.GetUserId(User);
         var checkId       = new FoodcourtCheck()
         {
             FoodcourtCheckProducts = new List <FoodcourtCheckProduct>(),
             PaidPrice = (decimal)food.Price,
             TransactionDateAndTime = DateTime.Now,
             WorkerId = Guid.Parse(currentUserId)
         };
         for (int i = 0; i < food.TicketIds.Count; ++i)
         {
             checkId.FoodcourtCheckProducts.Add(new FoodcourtCheckProduct()
             {
                 FoodcourtCheckId = checkId.Id,
                 FoodAmountId     = food.TicketIds[i].Id,
                 AmountOfProduct  = food.TicketIds[i].Amount
             });
             var oldFoodAmount = foodAmountService.GetById(food.TicketIds[i].Id);
             oldFoodAmount.ProductAmount -= food.TicketIds[i].Amount;
             foodAmountService.Update(oldFoodAmount);
         }
         foodcourtCheckService.Add(checkId);
         return(checkId.Id);
     }
     catch
     {
         return(0);
     }
 }
Exemplo n.º 2
0
        public async Task <byte[]> DecesionCreatePDFAsyncForFood(FoodcourtCheck pdfData)
        {
            IPDFSettings pdfSettings = new PDFSettings()
            {
                Title = string.Format("Check")
            };
            IPDFCreator creator = new PDFCreator(new FoodCheck(pdfData, pdfSettings));

            return(await Task.Run(() => creator.GetPDFBytes()));
        }
Exemplo n.º 3
0
 public FoodCheck(FoodcourtCheck ticket, IPDFSettings settings) : base(settings)
 {
     this.ticket   = ticket;
     this.settings = settings;
 }
Exemplo n.º 4
0
 public FoodCheck(FoodcourtCheck ticket) : this(ticket, new PDFSettings())
 {
 }