Beispiel #1
0
        public ActionResult AddWatch(Watch watch)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View("AddWatch", watch));
                }

                else
                {
                    WatchBL            watchBL = new WatchBL();
                    HttpPostedFileBase file    = Request.Files["imageFile"];
                    if (file != null && file.ContentLength > 0)
                    {
                        watch.ProductImage = file.FileName;
                        file.SaveAs(HttpContext.Server.MapPath("~/Images/") + watch.ProductImage);
                    }
                    watchBL.AddWatch(watch);
                    return(RedirectToAction("WatchList"));
                }
            }
            catch
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult WatchList()
        {
            WatchListVM  watchListVM = new WatchListVM();
            WatchBL      watchBL     = new WatchBL();
            List <Watch> watchList   = new List <Watch>();

            watchListVM.WatchVMList = WatchList2WatchVMList(watchBL.GetWatchList());

            return(View(watchListVM));
        }
Beispiel #3
0
        //public ActionResult DeleteWatch()
        //{

        //    return View();
        //}


        //[HttpPost]
        public ActionResult DeleteWatch(Watch watch)
        {
            try
            {
                WatchBL watchBL = new WatchBL();
                watchBL.DeleteWatch(watch.WatchId);

                return(RedirectToAction("WatchList"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #4
0
        public ActionResult EditWatch(Watch watch)
        {
            try
            {
                WatchBL watchBL = new WatchBL();
                watchBL.EditWatch(watch.WatchId, watch.Name, watch.Cost, watch.Description);

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