예제 #1
0
        public ActionResult Delete(int id)
        {
            var attachment = this.AttachmentService.GetById(id);

            if (attachment == null)
            {
                return base.HttpNotFound();
            }

            var privilege = new AttachmentPrivilege();

            return privilege.CanDelete(attachment) ? base.View(Views.Delete, new AttachmentDelete(attachment)) : NotAuthorized();
        }
예제 #2
0
        public ActionResult Delete(AttachmentDelete value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var attachment = this.AttachmentService.GetById(value.Id);

            if (attachment == null)
            {
                return base.HttpNotFound();
            }

            var privilege = new AttachmentPrivilege();

            if (!privilege.CanDelete(attachment))
            {
                return NotAuthorized();
            }

            this.AttachmentService.Delete(attachment, value.Soft);

            return base.RedirectToRoute(AdministrationRoutes.AttachmentIndex);
        }