Пример #1
0
        public void GetAllPromoCodes_Test()
        {
            //arrange

            //act

            //assert

            Assert.IsType <List <PromoCode> >(PromoCode.GetAllPromoCodes());
        }
Пример #2
0
 public ActionResult ViewPromos()
 {
     try
     {
         List <PromoCodeViewModel> model = new List <PromoCodeViewModel>();
         foreach (var item in PromoCode.GetAllPromoCodes())
         {
             model.Add(new PromoCodeViewModel
             {
                 Discount = item.DiscountPercent,
                 Code     = item.Code,
                 IsOpen   = item.IsOpen
             });
         }
         return(View(model));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("ErrorPage", "Error", ex));
     }
 }