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")); }
public bool Delete(long InstituicaoId) { return(_institutionRepository.Delete(InstituicaoId)); }
public void Delete(long id) { _institutionRepository.Delete(id); }