示例#1
0
 public ActionResult Delete(Guid id, FormCollection collection)
 {
     try
     {
         dc.Image_Delete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         ViewBag.Message = "Error in image delete";
         var image = dc.Images.Where(x => x.Id == id).Select(m => new Image
         {
             Id             = m.Id,
             Admin_Username = m.Admin_Username,
             Alt            = m.Alt,
             Description    = m.Description,
             Url            = m.Url
         }).FirstOrDefault();
         if (Request.IsAjaxRequest())
         {
             return(PartialView(image));
         }
         return(View(image));
     }
 }
示例#2
0
 public ActionResult Delete(Guid?id, FormCollection collection)
 {
     try
     {
         dc.Image_Delete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         ViewBag.Message = "خطا در حذف فایل";
         var image = dc.Images.Where(x => x.Id == id).Select(m => new MusicProduction.Models.Image {
             عکس = m.عکس, Id = m.Id, توضیحات = m.توضیحات
         }).FirstOrDefault();
         if (Request.IsAjaxRequest())
         {
             return(PartialView(image));
         }
         return(View(image));
     }
 }