Exemplo n.º 1
0
        public ActionResult DeleteImages(int partnerId)
        {
            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;
            AboutUsDataService auDS = new AboutUsDataService();

            try
            {
                auDS.DeleteImage(partnerId);
                return(RedirectToAction("Edit", "About"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                auDS = null;
            }
        }
Exemplo n.º 2
0
        public ActionResult AddImages()
        {
            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;
            AboutUsDataService auDS = new AboutUsDataService();
            PartnersModel      pm   = new PartnersModel();

            try
            {
                string homeImage = (string)Request.Form["home_image"];


                WebImage photo       = null;
                var      newFileName = "";
                var      imagePath   = "";

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

                    photo.Save(@"~\" + imagePath);
                    auDS.InsertPartner(imagePath);
                }

                return(RedirectToAction("Edit", "About"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                auDS = null;
            }
        }
Exemplo n.º 3
0
        public ActionResult EditAboutUs(AboutUsModel 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;
            AboutUsDataService auDS         = new AboutUsDataService();
            string             aboutUsId    = (string)Request.Form["edit_AboutUsId"];
            string             aboutUsTitle = (string)Request.Form["edit_AboutUsTitle"];

            try
            {
                if (ModelState.IsValid)
                {
                    aum.AboutUsId = int.Parse(aboutUsId);
                    auDS.UpdateAboutUs(aum);
                    return(RedirectToAction("Edit", "About"));
                }
                else
                {
                    aum              = new AboutUsModel();
                    aum.AboutUsId    = int.Parse(aboutUsId);
                    aum.AboutUsTitle = aboutUsTitle;
                    return(View(aum));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                auDS = null;
            }
        }
Exemplo n.º 4
0
        public ActionResult Edit()
        {
            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;
            AboutUsViewModel auVM = new AboutUsViewModel();

            AboutUsDataService auDS = new AboutUsDataService();

            try
            {
                auVM.AboutUsModel = auDS.GenerateAboutUsModel();

                auVM.PartnersModel = auDS.GeneratePartnerModel();

                return(View(auVM));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                auVM = null;
                auDS = null;
            }
        }