Ejemplo n.º 1
0
        public ActionResult InstitutionJournalLicenseDelete(int id, InstitutionJournalLicenseDeleteViewModel model)
        {
            if (!this.User.IsInRole(ApplicationRole.Admin) && !this.User.IsInRole(ApplicationRole.InstitutionAdmin))
            {
                return(new HttpUnauthorizedResult());
            }

            if (this.ModelState.IsValid)
            {
                var institutionJournal = this.institutionJournalRepository.Find(id, model.Institution);
                if (institutionJournal == null)
                {
                    return(new HttpNotFoundResult());
                }

                this.institutionJournalRepository.Delete(institutionJournal);
                this.institutionJournalRepository.Save();

                return(this.Redirect(model.RefererUrl));
            }

            return(this.RedirectToAction("InstitutionJournalLicense", new { id, InstitutionId = model.Institution, model.RefererUrl }));
        }
Ejemplo n.º 2
0
        public ActionResult InstitutionJournalLicenseDelete(int id, InstitutionJournalLicenseDeleteViewModel model)
        {
            if (!User.IsInRole(ApplicationRole.Admin) && !User.IsInRole(ApplicationRole.InstitutionAdmin))
            {
                return new HttpUnauthorizedResult();
            }

            if (ModelState.IsValid)
            {
                var institutionJournal = institutionJournalRepository.Find(id, model.Institution);
                if (institutionJournal == null)
                {
                    return new HttpNotFoundResult();
                }

                institutionJournalRepository.Delete(institutionJournal);
                institutionJournalRepository.Save();

                return Redirect(model.RefererUrl);
            }

            return RedirectToAction("InstitutionJournalLicense", new { id, InstitutionId = model.Institution, model.RefererUrl });
        }