public void UpdateLDAPSettings(LDAPConfigViewModel model) { config.LDAP_USERNAME = model.Username; config.LDAP_SERVER = model.Server; config.LDAP_PASSWORD = model.Password; config.LDAP_DESCRIPTION = model.Description; config.LDAP_DAYS_VALID = model.DaysValid.ToString(); }
public ActionResult LDAPSettings(LDAPConfigViewModel model) { if (ModelState.IsValid) { try { repo.UpdateLDAPSettings(model); return(PartialView("_Success", "Active Directory settings have been updated")); } catch (Exception e) { return(PartialView("_Error", e.Message)); } } List <string> errors = ModelState.Where(x => x.Value.Errors.Count > 0).SelectMany(x => x.Value.Errors).Select(x => x.ErrorMessage).ToList(); return(PartialView("_ValidationError", errors)); }