public void UpdateAllPromos() { var Promos = PromosRepository.GetAll(); DateTime Now = DateTime.Now; foreach (var promo in Promos) { if (promo.EndDate <= Now) { promo.Product.PriceEU = promo.Product.OriginalPriceEU; promo.Product.TagsText = "Ta5"; PromosRepository.Update(promo); PromosRepository.Delete(promo); } else if (promo.StartDate < Now && promo.Active == false) { promo.Active = true; PromosRepository.Update(promo); } } }
public async Task <GenericResult> Delete(int id) { GenericResult result = new GenericResult(); result.Result = await PromoRepository.Delete(id); if (!result.Result) { result.Message = "Error deleting promo"; } return(result); }