public ActionResult DeleteOrganization(long id) { using (AdministrationRepository repo = new AdministrationRepository()) { if (repo.DeleteOrganization(id)) { repo.Save(); return(View("DeleteOrganizationConfirmation")); } } return(View("Error")); }
public ActionResult EditOrganization(Organization organization) { if (ModelState.IsValid) { AdministrationRepository repo = new AdministrationRepository(); Organization organization_saved = repo.FindOrganization(organization.Id).ShallowCopy(); //organization.UpdatedBy = (long)TempData["admin_id"]; bool success = repo.UpdateOrganization(organization); if (success) { return(RedirectToAction("EditOrganizationConfirmation", organization_saved)); } } return(View("Error")); }
private static async Task InitializeInternal() { lock (_lock) { if (AdministrationRepository != null) { return; } AdministrationRepository = new AdministrationRepository(IdentityConfiguration); RoleRepository = new RoleRepository(IdentityConfiguration); UserRepository = new UserRepository(IdentityConfiguration); } await AdministrationRepository.ResetCollections(Context).ConfigureAwait(false); }
public ActionResult CreateEmployee(Employee employee) { bool success = false; if (ModelState.IsValid) { using (AdministrationRepository repo = new AdministrationRepository()) { success = repo.CreateEmployee(employee); repo.Save(); if (success) { View("CreateEmployeeConfirmation"); } } } return(View("Error")); }
public ActionResult CreateOrganization(Organization organization) { if (ModelState.IsValid) { using (AdministrationRepository repo = new AdministrationRepository()) { string asp_id = User.Identity.GetUserId(); Employee e = repo.GetEmployeeByAspId(asp_id); organization.CreatedBy = e.Id; bool success = repo.CreateOrganization(organization); repo.Save(); if (success) { return(View("CreateOrganizationConfirmation")); } } } return(View("Error")); }