Ejemplo n.º 1
0
 public int Save(Slider slider)
 {
     SliderRepository sliderRepository = new SliderRepository();
     if (slider.ID > 0)
         return sliderRepository.Update(slider);
     else
         return sliderRepository.Insert(slider);
 }
Ejemplo n.º 2
0
        public int Save(Slider slider)
        {
            SliderRepository sliderRepository = new SliderRepository();

            if (slider.ID > 0)
            {
                return(sliderRepository.Update(slider));
            }
            else
            {
                return(sliderRepository.Insert(slider));
            }
        }
Ejemplo n.º 3
0
        public IHttpActionResult Post(SlideImage sd, HttpPostedFileBase file)
        {
            string pic = null;

            if (file != null)
            {
                pic = System.IO.Path.GetFileName(file.FileName);
                string path = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~/I_SliderImg/"), pic);
                // file is uploaded
                file.SaveAs(path);
            }
            sd.SlideImage1 = pic;
            SR.Update(sd);
            return(Ok(sd));
        }
        public ActionResult Edit(SliderModel slidermodel, int id, HttpPostedFileBase image)
        {
            if (image != null && image.ContentLength > 0)
            {
                var fileName = Path.GetFileName(image.FileName);
                slidermodel.SliderImage = fileName;
                var path = Path.Combine(Server.MapPath("~/Content/images/slider"), fileName);
                image.SaveAs(path);
            }

            Slider slider = new Slider()
            {
                SliderId    = id,
                SliderImage = slidermodel.SliderImage,
                SliderUrl   = slidermodel.SliderUrl
            };

            sliderRepo.Update(slider);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
 public IHttpActionResult Put([FromUri] int id, [FromBody] Slider slider)
 {
     slider.SliderId = id;
     SliderRepo.Update(slider);
     return(Ok(slider));
 }