Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        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);
        }