コード例 #1
0
        public ActionResult DeleteInstitution(UpsertViewModel model)
        {
            if (!model.Id.HasValue)
            {
                return(new HttpNotFoundResult());
            }

            var institution = institutionRepository.Find(model.Id.Value);

            if (institution == null)
            {
                return(new HttpNotFoundResult());
            }

            if (institution.UserProfiles.Any())
            {
                ModelState["File"].Errors.Clear();
                ModelState.AddModelError("noetempty", $"There are {institution.UserProfiles.Count} users registered under this domain. Institution {institution.Name} cannot be deleted.");
                return(View("DeleteInstitution", model));
            }


            institutionRepository.Delete(institution);
            institutionRepository.Save();

            return(RedirectToAction("InstitutionDeleted"));
        }
コード例 #2
0
 public bool Delete(long InstituicaoId)
 {
     return(_institutionRepository.Delete(InstituicaoId));
 }
コード例 #3
0
 public void Delete(long id)
 {
     _institutionRepository.Delete(id);
 }