public async Task <bool> Create(DirectSalesOrderPromotion DirectSalesOrderPromotion) { DirectSalesOrderPromotionDAO DirectSalesOrderPromotionDAO = new DirectSalesOrderPromotionDAO(); DirectSalesOrderPromotionDAO.Id = DirectSalesOrderPromotion.Id; DirectSalesOrderPromotionDAO.DirectSalesOrderId = DirectSalesOrderPromotion.DirectSalesOrderId; DirectSalesOrderPromotionDAO.ItemId = DirectSalesOrderPromotion.ItemId; DirectSalesOrderPromotionDAO.UnitOfMeasureId = DirectSalesOrderPromotion.UnitOfMeasureId; DirectSalesOrderPromotionDAO.Quantity = DirectSalesOrderPromotion.Quantity; DirectSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = DirectSalesOrderPromotion.PrimaryUnitOfMeasureId; DirectSalesOrderPromotionDAO.RequestedQuantity = DirectSalesOrderPromotion.RequestedQuantity; DirectSalesOrderPromotionDAO.Note = DirectSalesOrderPromotion.Note; DirectSalesOrderPromotionDAO.Factor = DirectSalesOrderPromotion.Factor; DataContext.DirectSalesOrderPromotion.Add(DirectSalesOrderPromotionDAO); await DataContext.SaveChangesAsync(); DirectSalesOrderPromotion.Id = DirectSalesOrderPromotionDAO.Id; await SaveReference(DirectSalesOrderPromotion); return(true); }
public async Task <bool> BulkMerge(List <DirectSalesOrderPromotion> DirectSalesOrderPromotions) { List <DirectSalesOrderPromotionDAO> DirectSalesOrderPromotionDAOs = new List <DirectSalesOrderPromotionDAO>(); foreach (DirectSalesOrderPromotion DirectSalesOrderPromotion in DirectSalesOrderPromotions) { DirectSalesOrderPromotionDAO DirectSalesOrderPromotionDAO = new DirectSalesOrderPromotionDAO(); DirectSalesOrderPromotionDAO.Id = DirectSalesOrderPromotion.Id; DirectSalesOrderPromotionDAO.DirectSalesOrderId = DirectSalesOrderPromotion.DirectSalesOrderId; DirectSalesOrderPromotionDAO.ItemId = DirectSalesOrderPromotion.ItemId; DirectSalesOrderPromotionDAO.UnitOfMeasureId = DirectSalesOrderPromotion.UnitOfMeasureId; DirectSalesOrderPromotionDAO.Quantity = DirectSalesOrderPromotion.Quantity; DirectSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = DirectSalesOrderPromotion.PrimaryUnitOfMeasureId; DirectSalesOrderPromotionDAO.RequestedQuantity = DirectSalesOrderPromotion.RequestedQuantity; DirectSalesOrderPromotionDAO.Note = DirectSalesOrderPromotion.Note; DirectSalesOrderPromotionDAO.Factor = DirectSalesOrderPromotion.Factor; DirectSalesOrderPromotionDAOs.Add(DirectSalesOrderPromotionDAO); } await DataContext.BulkMergeAsync(DirectSalesOrderPromotionDAOs); return(true); }
public async Task <bool> Update(DirectSalesOrderPromotion DirectSalesOrderPromotion) { DirectSalesOrderPromotionDAO DirectSalesOrderPromotionDAO = DataContext.DirectSalesOrderPromotion.Where(x => x.Id == DirectSalesOrderPromotion.Id).FirstOrDefault(); if (DirectSalesOrderPromotionDAO == null) { return(false); } DirectSalesOrderPromotionDAO.Id = DirectSalesOrderPromotion.Id; DirectSalesOrderPromotionDAO.DirectSalesOrderId = DirectSalesOrderPromotion.DirectSalesOrderId; DirectSalesOrderPromotionDAO.ItemId = DirectSalesOrderPromotion.ItemId; DirectSalesOrderPromotionDAO.UnitOfMeasureId = DirectSalesOrderPromotion.UnitOfMeasureId; DirectSalesOrderPromotionDAO.Quantity = DirectSalesOrderPromotion.Quantity; DirectSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = DirectSalesOrderPromotion.PrimaryUnitOfMeasureId; DirectSalesOrderPromotionDAO.RequestedQuantity = DirectSalesOrderPromotion.RequestedQuantity; DirectSalesOrderPromotionDAO.Note = DirectSalesOrderPromotion.Note; DirectSalesOrderPromotionDAO.Factor = DirectSalesOrderPromotion.Factor; await DataContext.SaveChangesAsync(); await SaveReference(DirectSalesOrderPromotion); return(true); }