Ejemplo n.º 1
0
        public ActionResult Add(ProductsListModel plm)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductsDataService dataService = new ProductsDataService();
            try
            {
                if (ModelState.IsValid)
                {
                    dataService.InsertProductList(plm);
                    return RedirectToAction("Edit", "Products");
                }
                else
                {
                    return View(plm);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Ejemplo n.º 2
0
        public ActionResult DeleteProducts(int productId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductsDataService dataService = new ProductsDataService();
            try
            {
                dataService.DeleteProducts(productId);
                return RedirectToAction("Edit", "Products");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dataService = null;

            }
        }
Ejemplo n.º 3
0
        // GET: Products
        public ActionResult Index()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductsPageViewMainModel ppvMM = new ProductsPageViewMainModel();

            ProductsDataService pDS = new ProductsDataService();

            try
            {
                ppvMM.ProductsMainModel = pDS.GenerateProductsMainModel();

                ppvMM.ProductsListModel = pDS.GenerateProductsListModel();

                return View(ppvMM);
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                ppvMM = null;
                pDS = null;
            }
        }
Ejemplo n.º 4
0
        public ActionResult EditProductsMainImage()
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductsDataService auDS = new ProductsDataService();

            try
            {
                WebImage photo = null;
                var newFileName = "";
                var imagePath = "";
                string id = (string)Request.Form["edit_ProductsMainId"];

                photo = WebImage.GetImageFromRequest();
                if (photo != null)
                {
                    newFileName = Guid.NewGuid().ToString() + "_" +
                        Path.GetFileName(photo.FileName);
                    imagePath = @"Contents\Images\Products\" + newFileName;

                    photo.Save(@"~\" + imagePath);
                    auDS.UpdateProductsMainImage(int.Parse(id), imagePath);
                }

                return RedirectToAction("Edit", "Products");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                auDS = null;
            }
        }
Ejemplo n.º 5
0
        public ActionResult EditProductsMain(ProductsMainModel aum)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductsDataService auDS = new ProductsDataService();
            string id = (string)Request.Form["edit_ProductsMainId"];
            try
            {
                if (ModelState.IsValid)
                {
                    aum.ProductsMainId = int.Parse(id);
                    auDS.UpdateProductsMain(aum);
                    return RedirectToAction("Edit", "Products");
                }
                else
                {
                    aum = new ProductsMainModel();
                    aum.ProductsMainId = int.Parse(id);
                    return View(aum);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                auDS = null;
            }
        }
Ejemplo n.º 6
0
        public ActionResult EditProduct(int productId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            ProductsListModel model = new ProductsListModel();

            ProductsDataService dataService = new ProductsDataService();

            try
            {
                model = dataService.GetProductsListModelByProductId(productId);

                return View(model);
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                model = null;
                dataService = null;
            }
        }