Exemplo n.º 1
0
        public ActionResult EditService(int id)
        {
            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;
            ServicesModel       model       = new ServicesModel();
            ServicesDataService dataservice = new ServicesDataService();

            try
            {
                model = dataservice.GetServicesModelByServiceId(id);

                return(View(model));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                model       = null;
                dataservice = null;
            }
        }
Exemplo n.º 2
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;
            ServicesViewModel viewModel = new ServicesViewModel();
            ServicesDataService dataservice = new ServicesDataService();
            try
            {
                int[] row1 = new int[] { 1, 2, 3 };
                int[] row2 = new int[] { 6, 4, 5 };
                viewModel.ServicesModelRow1 = dataservice.GenerateServiceModelByServicesIds(row1);
                viewModel.ServicesModelRow2 = dataservice.GenerateServiceModelByServicesIds(row2);

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

                throw ex;
            }
            finally
            {
                viewModel = null;
                dataservice = null;
            }
        }
Exemplo n.º 3
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;
            ServicesViewModel   viewModel   = new ServicesViewModel();
            ServicesDataService dataservice = new ServicesDataService();

            try
            {
                int[] row1 = new int[] { 1, 2, 3 };
                int[] row2 = new int[] { 6, 4, 5 };
                viewModel.ServicesModelRow1 = dataservice.GenerateServiceModelByServicesIds(row1);
                viewModel.ServicesModelRow2 = dataservice.GenerateServiceModelByServicesIds(row2);

                return(View(viewModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                viewModel   = null;
                dataservice = null;
            }
        }
Exemplo n.º 4
0
        public ActionResult EditService(int id)
        {
            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;
            ServicesModel model = new ServicesModel();
            ServicesDataService dataservice = new ServicesDataService();
            try
            {
                model = dataservice.GetServicesModelByServiceId(id);

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

                throw ex;
            }
            finally
            {
                model = null;
                dataservice = null;
            }
        }
Exemplo n.º 5
0
        public ActionResult EditService(ServicesModel model)
        {
            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;
            ServicesDataService dataservice = new ServicesDataService();
            string serviceId = (string)Request.Form["edit_ServicesId"];
            string imageString = (string)Request.Form["edit_ImageString"];
            string serviceName = (string)Request.Form["edit_ServiceName"];
            try
            {
                if (ModelState.IsValid)
                {
                    WebImage photo = null;
                    var newFileName = "";
                    var imagePath = "";

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

                        photo.Save(@"~\" + imagePath);
                        model.ServicesId = int.Parse(serviceId);
                        model.ImageString = imagePath;

                    }
                    else
                    {
                        model.ServicesId = int.Parse(serviceId);
                        model.ImageString = imageString;
                    }

                    dataservice.UpdateService(model);
                    return RedirectToAction("Edit", "Services");
                }
                else
                {
                    model.ServicesId = int.Parse(serviceId);
                    model.ImageString = imageString;
                    return View(model);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                model = null;
                dataservice = null;
            }
        }
Exemplo n.º 6
0
        public ActionResult EditService(ServicesModel model)
        {
            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;
            ServicesDataService dataservice = new ServicesDataService();
            string serviceId   = (string)Request.Form["edit_ServicesId"];
            string imageString = (string)Request.Form["edit_ImageString"];
            string serviceName = (string)Request.Form["edit_ServiceName"];

            try
            {
                if (ModelState.IsValid)
                {
                    WebImage photo       = null;
                    var      newFileName = "";
                    var      imagePath   = "";

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

                        photo.Save(@"~\" + imagePath);
                        model.ServicesId  = int.Parse(serviceId);
                        model.ImageString = imagePath;
                    }
                    else
                    {
                        model.ServicesId  = int.Parse(serviceId);
                        model.ImageString = imageString;
                    }

                    dataservice.UpdateService(model);
                    return(RedirectToAction("Edit", "Services"));
                }
                else
                {
                    model.ServicesId  = int.Parse(serviceId);
                    model.ImageString = imageString;
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                model       = null;
                dataservice = null;
            }
        }