Beispiel #1
0
        public ActionResult Create(CreateQuoteDetailsDto QuoteDetail, int orderId)
        {
            var result = _quoteDetailService.Create(QuoteDetail, orderId);

            return(CreatedAtAction(
                       "GetById",
                       new { id = result.QuoteDetailsId },
                       result
                       ));
        }
Beispiel #2
0
        public void PrepareLoc(Order order, CreateQuoteDetailsDto entry)
        {
            var customer = _context.Customers.Single(x => x.CustomerId == order.CustomerId);
            var loc      = _context.LOCs.Single(x => x.CustomerId == customer.CustomerId);

            if (loc.AvalibleLineOfCredit > order.TotalPrice)
            {
                loc.AvalibleLineOfCredit -= order.TotalPrice;
                _quoteDetailService.Create(new CreateQuoteDetailsDto {
                    Frecuency = entry.Frecuency, LocId = loc.LOCId, NumberQuotes = entry.NumberQuotes, Currency = entry.Currency
                }, order.TotalPrice);
                DecreaseStock(order);
                _transactionService.Create(new TransactionCreateDto {
                    CustomerId = customer.CustomerId, Description = "La orden ha sido creada correctamente", Status = "Accepted"
                });
            }
            else
            {
                _transactionService.Create(new TransactionCreateDto {
                    CustomerId = customer.CustomerId, Description = "No hay suficiente dinero disponible en la linea de credito", Status = "Rejected"
                });
            }
        }