public void GetAllPromoCodes_Test() { //arrange //act //assert Assert.IsType <List <PromoCode> >(PromoCode.GetAllPromoCodes()); }
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)); } }