Beispiel #1
0
        public ActionResult AddCap(Cap cap)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View("AddCap", cap));
                }

                else
                {
                    CapBL capBL             = new CapBL();
                    HttpPostedFileBase file = Request.Files["imageFile"];
                    if (file != null && file.ContentLength > 0)
                    {
                        cap.ProductImage = file.FileName;
                        file.SaveAs(HttpContext.Server.MapPath("~/Images/") + cap.ProductImage);
                    }
                    capBL.AddCap(cap);
                    return(RedirectToAction("CapList"));
                }
            }
            catch
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult CapList()
        {
            CapListVM  capListVM = new CapListVM();
            CapBL      capBL     = new CapBL();
            List <Cap> capList   = new List <Cap>();

            capListVM.CapVMList = CapList2CapVMList(capBL.GetCapList());

            return(View(capListVM));
        }
Beispiel #3
0
        public ActionResult EditCap(Cap cap)
        {
            try
            {
                CapBL capBL = new CapBL();
                capBL.EditCap(cap.CapId, cap.Name, cap.Cost, cap.Description);

                return(RedirectToAction("CapList"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #4
0
        //public ActionResult DeleteCap()
        //{

        //    return View();
        //}


        //[HttpPost]
        public ActionResult DeleteCap(Cap cap)
        {
            try
            {
                CapBL capBL = new CapBL();

                capBL.DeleteCap(cap.CapId);

                return(RedirectToAction("CapList"));
            }
            catch
            {
                return(View());
            }
        }