public Guid AddOrdering(AddOrderingCommand command) { string orderCode = _keyGenerationReportService.GetCode(KeyTypeObjects.Order).CodeNew; var ordering = new Ordering() { OrderingId = Guid.NewGuid(), Address = command.Address, Phone = command.Phone, ExchangeRateId = command.ExchangeRateId, Note = command.Note, TotalDiscuss = command.TotalDiscuss, PersonId = command.PersonId, CreatedDate = DateTime.Now, Status = (int)StatusOrderingEnum.New, OrderingCode = orderCode, IsDelivered = false, IsDeposit = false, IsPaid = false, IsDownPayment = false, IsPayAtHome = false, NoteApproved = "", NoteCustomer = "", CreatedByName = "", CreatedBy = command.PersonId, Type = 0, TotalAmount = 0, TotalCount = 0, TotalCustomFees = 0, TotalDomesticCharges = 0, TotalDownPayment = 0, TotalQuantity = 0, TotalPrice = 0, TotalShipAbroad = 0, TotalShipInternal = 0, TotalVat = 0, TotalWage = 0, TransportFee = 0, WeightFee = 0 }; _orderingService.Insert(ordering); _unitOfWork.SaveChanges(); return(ordering.OrderingId); }
public Guid AddOrderingDetail(AddOrderingDetailCommand command) { string orderingDetailCode = _keyGenerationReportService.GetCode(KeyTypeObjects.OrderDetail).CodeNew; var orderingDetail = new OrderingDetail() { Brand = command.Brand, Color = command.Color, Link = command.Link, LinkUrl = command.LinkUrl, Name = command.Name, Note = command.Note, OrderingDetailId = Guid.NewGuid(), Price = command.Price, ProductCode = command.ProductCode, Quantity = command.Quantity, Size = command.Size, OrderingDetailCode = orderingDetailCode, OrderingId = command.OrderingId }; _orderingDetailService.Insert(orderingDetail); _unitOfWork.SaveChanges(); return orderingDetail.OrderingDetailId; }