public async Task <ActionResult> DeleteConfirmed(int id)
        {
            var image = await db.GetByIdAsync(id);

            db.Remove(image);

            if (image.ImageUrl != null)
            {
                var fullPath = Server.MapPath("~/Public/Images/" + image.ImageUrl);

                // Remove file from the disk.
                if (System.IO.File.Exists(fullPath + "_thumb.jpg"))
                {
                    System.IO.File.Delete(fullPath + "_thumb.jpg");
                }

                if (System.IO.File.Exists(fullPath + "_large.jpg"))
                {
                    System.IO.File.Delete(fullPath + "_large.jpg");
                }
            }

            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ReferencedLink referencedlink = await db.GetByIdAsync(id);

            db.Remove(referencedlink);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Specimen specimen = await db.GetByIdAsync(id);

            db.Remove(specimen);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Process process = await db.GetByIdAsync(id);

            db.Remove(process);

            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            var e = await db.GetByIdAsync(id);

            foreach (var att in e.Attachments.ToList())
            {
                var path = Server.MapPath("~/Public/Attachments/" + att.FileName);

                if (System.IO.File.Exists(path))
                {
                    System.IO.File.Delete(path);
                }
            }

            db.Remove(e);

            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            var collection = await db.GetByIdAsync(id);

            db.Remove(collection);

            if (collection.LogoLocation != null)
            {
                var fullPath = Server.MapPath("~/Public/Collections/" + collection.LogoLocation);

                // Remove file from the disk.
                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                }
            }

            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }