public ActionResult Apparel(AddApparel model)
        {
            if (!CheckAdmin())
                return (View("~/Views/Shared/Unauthorized.cshtml"));

            ViewBag.categoryData = UtilityFunctions.getCategoryDropDown();
            AdminBLL obj = new AdminBLL();
            string AppID;
            bool result = obj.addApparel(model, out AppID);
            if (result)
            {
                ViewBag.Message = "Sucessfully added apparel";
            }

            else
                ViewBag.Message = "Unable to add apparel";

            return View(model);
        }
        public string FetchByDate(string date)
        {
            AdminBLL obj = new AdminBLL();
            Offer model = obj.fetchOfferByDate(date);
            JavaScriptSerializer jsonobj = new JavaScriptSerializer();

            return (jsonobj.Serialize(model));
        }
        public string DeleteOffer(string offerDate)
        {
            if (!CheckAdmin())
                return ("<h1 style='Color:red'>You Are NOT AUTHORIZED to access this Page ..! <h1>");

            AdminBLL obj = new AdminBLL();
            if (obj.DeleteOffer(offerDate))
            {
                return "true";
            }
            return "false";
        }
        public bool UpdateApparel(string apparelID, string  cost, string discount, string quantity, string category, string size )
        {
            if (!CheckAdmin())
                return (false);

            AdminBLL obj = new AdminBLL();
            bool result = obj.UpdateApparel(apparelID, cost, discount, quantity, category, size);
            return result;
        }
        public string UpdateOffer(string offerDate, string offerName, string offerDescription, string offerDiscount)
        {
            if (!CheckAdmin())
                return ("<h1 style='Color:red'>You Are NOT AUTHORIZED to access this Page ..! <h1>");

            AdminBLL obj = new AdminBLL();
            if (obj.UpdateOffer(offerDate, offerName, offerDescription, offerDiscount))
            {
                return "true";
            }
            return "false";
        }
 public ActionResult SearchByCategory(string val)
 {
     AdminBLL obj = new AdminBLL();
     List<Apparel> listApparel = obj.fetchProductByCategory(val);
     //ViewBag.Message = listApparel[0].ApparelName;
     string msg = "0";
     if (listApparel.Count > 0)
         msg = listApparel[0].ApparelName;
     return PartialView("_apparelDetailsTable", listApparel);
 }
        public ActionResult Offer(Offer model)
        {
            AdminBLL obj = new AdminBLL();
               List<SelectListItem> defaultList = new List<SelectListItem>();
               defaultList = UtilityFunctions.getCategoryDropDown();
               // defaultList[0].Selected= false;

               // defaultList[Convert.ToInt32(ModelState["temp"])].Selected = true;
            ViewBag.categoryData = defaultList;

            if (obj.addOffer(model))
            {
                ViewBag.Message = "Offer Added Successfully";
                Session["OfferMessage"] = "false";

            }
            else
            {
                if (Convert.ToString(Session["ErrorMessage"]) == "Offer with Same Date exists")
                {
                    Session["OfferMessage"] = "true";
                    Session["ErrorMessage"] = "Offer with Same Date Exists. Try Updating the Offer!";
                    ViewBag.Message = "";

                }
                else
                {
                    Session["OfferMessage"] = "true";
                    Session["ErrorMessage"] = "Unable to add Offer";
                }
            }
            return View(model); ;
        }
        public ActionResult GetBrandNames()
        {
            if (!CheckAdmin())
                return (View("~/Views/Shared/Unauthorized.cshtml"));

            AdminBLL obj = new AdminBLL();
            List<DropDownFormat> result = obj.GetBrandNames();
            SelectList resList = new SelectList(result, "value", "name");
            return Json(resList);
        }
        public ActionResult GetApparelsByBrandAndName(string name, string brand)
        {
            if (!CheckAdmin())
                return (View("~/Views/Shared/Unauthorized.cshtml"));

            AdminBLL obj = new AdminBLL();
            List<AddApparel> listApparel = obj.GetApparelsByBrandAndName(name, brand);
            return PartialView("_updateApparel", listApparel);
        }
        public ActionResult GetApparelNameByBrand(string brand)
        {
            if (!CheckAdmin())
                return (Content("<h1 style='Color:red'>You Are NOT AUTHORIZED to access this Page ..! <h1>"));

            AdminBLL obj = new AdminBLL();
            List<DropDownFormat> result = obj.GetApparelNameByBrand(brand);
            SelectList resList = new SelectList(result, "value", "name");
            return Json(resList);
        }