public ActionResult Index() { if (Session["UserRole"] != null && Session["UserRole"].ToString() == "admin") { return (RedirectToAction("Offer", "Admin")); } CustomerBLL obj = new CustomerBLL(); List<Offer> offer = new List<Offer>(); offer = obj.GetTodaysOffer(); if (offer.Count == 0 || offer[0].OfferID == null) { ViewBag.OfferTitle = "none"; } else { ViewBag.OfferTitle = offer[0].OfferName; ViewBag.OfferDescription = offer[0].OfferDescription; } return View(); }
public ActionResult OfferOfDay() { ViewBag.Title = "Offer of The Day!!!"; CustomerBLL obj = new CustomerBLL(); List<Offer> model = new List<Offer>(); model = obj.GetTodaysOffer(); Apparel apparel = new Apparel(); if (model.Count > 0) { apparel = obj.GetApparelByID(model[0].ApparelID)[0]; ViewBag.OfferID = model[0].OfferID; ViewBag.OfferName = model[0].OfferName; ViewBag.OfferDescription = model[0].OfferDescription; ViewBag.OfferDiscount = model[0].Discount; ViewBag.OfferName = model[0].OfferName; } else { ViewBag.OfferTitle = "none"; } return View(apparel); }