Exemplo n.º 1
0
        public bool DeleteSlide(int Id)
        {
            DataView dv = this.GetSlides(string.Format("Id = {0}", Id));

            if (dv.Count <= 0)
            {
                return(false);
            }

            SliderDS.SlidesRow row = (SliderDS.SlidesRow)dv[0].Row;

            row.Delete();
            AcceptChanges();

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deletes the existing slide based on it's unique ID
        /// </summary>
        /// <param name="Id">Id of the slide to be deleted</param>
        /// <returns>If slide not found it returns false else true</returns>
        public bool DeleteSlide(int Id)
        {
            DataView dv = this.GetSlides(string.Format("Id = {0}", Id));

            if (dv.Count <= 0)
            {
                return(false);
            }

            SliderDS.SlidesRow row = (SliderDS.SlidesRow)dv[0].Row;

            row.Delete();
            AcceptChanges();
            string path      = WebContext.Server.MapPath("~/" + lw.CTE.Folders.MainSliderFolder);
            string ImageName = string.Format("{0}\\{1}", path, Id + ".jpg");

            if (File.Exists(ImageName))
            {
                File.Delete(ImageName);
            }

            return(true);
        }