public async Task <bool> Delete(Discount_CustomerGrouping Discount_CustomerGrouping) { Discount_CustomerGroupingDAO Discount_CustomerGroupingDAO = await DataContext.Discount_CustomerGrouping.Where(x => x.DiscountId == Discount_CustomerGrouping.DiscountId && x.CustomerGroupingId == Discount_CustomerGrouping.CustomerGroupingId).FirstOrDefaultAsync(); DataContext.Discount_CustomerGrouping.Remove(Discount_CustomerGroupingDAO); await DataContext.SaveChangesAsync(); return(true); }
public async Task <bool> Update(Discount_CustomerGrouping Discount_CustomerGrouping) { Discount_CustomerGroupingDAO Discount_CustomerGroupingDAO = DataContext.Discount_CustomerGrouping.Where(x => x.DiscountId == Discount_CustomerGrouping.DiscountId && x.CustomerGroupingId == Discount_CustomerGrouping.CustomerGroupingId).FirstOrDefault(); Discount_CustomerGroupingDAO.DiscountId = Discount_CustomerGrouping.DiscountId; Discount_CustomerGroupingDAO.CustomerGroupingId = Discount_CustomerGrouping.CustomerGroupingId; await DataContext.SaveChangesAsync(); return(true); }
public async Task <bool> Create(Discount_CustomerGrouping Discount_CustomerGrouping) { Discount_CustomerGroupingDAO Discount_CustomerGroupingDAO = new Discount_CustomerGroupingDAO(); Discount_CustomerGroupingDAO.DiscountId = Discount_CustomerGrouping.DiscountId; Discount_CustomerGroupingDAO.CustomerGroupingId = Discount_CustomerGrouping.CustomerGroupingId; await DataContext.Discount_CustomerGrouping.AddAsync(Discount_CustomerGroupingDAO); await DataContext.SaveChangesAsync(); return(true); }
public async Task <Discount_CustomerGrouping> Get(long DiscountId, long CustomerGroupingId) { Discount_CustomerGrouping Discount_CustomerGrouping = await DataContext.Discount_CustomerGrouping.Where(x => x.DiscountId == DiscountId && x.CustomerGroupingId == CustomerGroupingId).Select(Discount_CustomerGroupingDAO => new Discount_CustomerGrouping() { DiscountId = Discount_CustomerGroupingDAO.DiscountId, CustomerGroupingId = Discount_CustomerGroupingDAO.CustomerGroupingId, CustomerGrouping = Discount_CustomerGroupingDAO.CustomerGrouping == null ? null : new CustomerGrouping { Id = Discount_CustomerGroupingDAO.CustomerGrouping.Id, Name = Discount_CustomerGroupingDAO.CustomerGrouping.Name, }, Discount = Discount_CustomerGroupingDAO.Discount == null ? null : new Discount { Id = Discount_CustomerGroupingDAO.Discount.Id, Name = Discount_CustomerGroupingDAO.Discount.Name, Start = Discount_CustomerGroupingDAO.Discount.Start, End = Discount_CustomerGroupingDAO.Discount.End, Type = Discount_CustomerGroupingDAO.Discount.Type, }, }).FirstOrDefaultAsync(); return(Discount_CustomerGrouping); }