public bool Create(AppliedPromotionCreateRequest entity) { int proId = entity.PromotionId; int storeId = entity.StoreId; AppliedPromotion existed = _repo.GetAll().FirstOrDefault(e => e.PromotionId == proId && e.StoreId == storeId); if (existed != null) { return(false); } AppliedPromotion newEntity = new AppliedPromotion(); newEntity.PromotionId = proId; newEntity.StoreId = storeId; return(_repo.Create(newEntity)); }
public bool Delete(AppliedPromotion entity) { _context.AppliedPromotions.Remove(entity); return(_context.SaveChanges() >= 0); }
public bool Update(AppliedPromotion entity) { _context.Entry(entity).State = EntityState.Modified; return(_context.SaveChanges() >= 0); }
public bool Create(AppliedPromotion entity) { _context.AppliedPromotions.Add(entity); return(_context.SaveChanges() >= 0); }