Ejemplo n.º 1
0
        public ActionResult Delete(int Id)
        {
            TestimonialHelper _helper          = new TestimonialHelper();
            TestimonialModel  testimonialModel = new TestimonialModel();

            testimonialModel = _helper.GetByID(Id);

            int count = _helper.Delete(testimonialModel);

            if (count == 0)
            {
                string filePath = Server.MapPath("~/Content/Resources/Testimonial") + "/" + testimonialModel.ImageFile;
                if (System.IO.File.Exists(filePath))
                {
                    System.IO.File.Delete(filePath);
                }
                // delete the file from s3
                AwsS3Bucket.DeleteObject("resources/testimonial/" + testimonialModel.ImageFile);


                TempData["CommonMessage"] = AppLogic.setMessage(count, "Record deleted successfully.");
            }
            else
            {
                TempData["CommonMessage"] = AppLogic.setMessage(count, "Record deletion failed.");
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int Id)
        {
            TestimonialHelper _Helper          = new TestimonialHelper();
            TestimonialModel  testimonialModel = new TestimonialModel();

            testimonialModel   = _Helper.GetByID(Id);
            ViewBag.StatusList = AppLogic.BindDDStatus(Convert.ToInt32(testimonialModel.Status));
            return(View(testimonialModel));
        }