public ActionResult Delete() { try { service.Delete(HttpContext.Request.Url); } catch (Exception e) { throw new HttpException(e.ToString(), e); } return(new HttpStatusCodeResult(200)); }
/// <summary> /// Remove the attachement files by specified attachment ids. /// </summary> /// <param name="attachmentIDs">The attachment id array.</param> /// <param name="service">The INetDriveService object.</param> public void DetachFiles(int[] attachmentIDs, INetDriveService service) { if (attachmentIDs == null) { throw new ArgumentNullException("attachmentIDs"); } if (service == null) { throw new ArgumentNullException("service"); } var attachs = Context.Where <ContentAttachment>(c => attachmentIDs.Contains(c.ID)); foreach (var attach in attachs) { service.Delete(new Uri(attach.Uri)); Context.Delete(attach); } Context.SaveChanges(); }