Ejemplo n.º 1
0
        public ActionResult EditTemplate()
        {
            TemplateModel Model = new TemplateModel()
            {
                GetTemplates = GenericMetodsservices.GetTemplates()
            };

            return View(Model);
        }
Ejemplo n.º 2
0
        public ActionResult EditTemplate(TemplateModel Model, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {

                var FilePath = "";
                if (Image != null)
                {
                    var fileName = Path.GetFileName(Image.FileName);
                    var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                    Image.SaveAs(path);
                    FilePath = "/UserProfilePictures/" + fileName;
                }
                if (Model.Templateid != null)
                {
                    Custome_Templates custom = new Custome_Templates()
                    {
                        Heading = Model.Heading,
                        Subject = Model.Subject,
                        Description = Model.Description,
                        Status = true,
                        createdOn = DateTime.Now,
                        Images = FilePath,
                        id = Model.Templateid
                    };
                    TempData["Message"] = "Updated successfully...";
                    GenericMetodsservices.InsertTemplates(custom);
                }
                else
                {
                    Custome_Templates custom = new Custome_Templates()
                    {
                        Heading = Model.Heading,
                        Subject = Model.Subject,
                        Description = Model.Description,
                        Status = true,
                        createdOn = DateTime.Now,
                        Images = FilePath
                    };
                    TempData["Message"] = "Saved successfully...";
                    GenericMetodsservices.InsertTemplates(custom);
                }

                return RedirectToAction("EditTemplate", "Extras", new { Area = "Admin" });
            }
            return View();
        }