public ActionResult Add(AddDelegationModel model) { if (!ModelState.IsValid) { return View(); } var setting = new DelegationSetting { UserName = model.UserName, Realm = new Uri(model.Realm), Description = model.Description }; try { Repository.Add(setting); } catch (Exception ex) { ModelState.AddModelError("", ex.InnerException.Message); return View("Add"); } return RedirectToAction("Index"); }
public void Delete(DelegationSetting setting) { var entity = (from e in NewContext.Delegation where e.PartitionKey == DefaultPartitionKey && e.UserName.Equals(setting.UserName, StringComparison.OrdinalIgnoreCase) && e.Realm.Equals(setting.Realm.AbsoluteUri, StringComparison.OrdinalIgnoreCase) select e) .Single(); NewContext.DeleteDelegation(entity.PartitionKey, entity.RowKey); }
public IHttpActionResult Post(DelegationSetting setting) { if (ModelState.IsValid) { _delegationRepository.Add(setting); return Ok(); } else { return BadRequest(ModelState); } }
public void Add(DelegationSetting setting) { using (var entities = IdentityServerConfigurationContext.Get()) { var entity = new Delegation { UserName = setting.UserName, Realm = setting.Realm.AbsoluteUri, Description = setting.Description }; entities.Delegation.Add(entity); entities.SaveChanges(); } }
public ActionResult Add(DelegationSetting model) { if (ModelState.IsValid) { try { this.delegationRepository.Add(model); TempData["Message"] = "Realm Added"; return RedirectToAction("Configure", new { id = model.UserName }); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } catch { ModelState.AddModelError("", "Error adding delegation setting."); } } var vm = new DelegationSettingsForUserViewModel(this.delegationRepository, this.userManagementRepository, model.UserName); return View("Configure", vm); }
public void Delete(DelegationSetting setting) { _apiClient.Delete<DelegationSetting>("api/delegations", setting); }
public void Add(DelegationSetting setting) { _apiClient.Post<DelegationSetting>("api/delegations", setting); }
public void Delete(DelegationSetting setting) { using (var entities = IdentityServerConfigurationContext.Get()) { var record = (from entry in entities.Delegation where entry.UserName.Equals(setting.UserName, StringComparison.OrdinalIgnoreCase) && entry.Realm.Equals(setting.Realm.AbsoluteUri, StringComparison.OrdinalIgnoreCase) select entry) .Single(); entities.Delegation.Remove(record); entities.SaveChanges(); } }
public IHttpActionResult Delete(DelegationSetting setting) { _delegationRepository.Delete(setting); return Ok(); }
public ActionResult Remove(DelegationSetting model) { try { this.delegationRepository.Delete(model); TempData["Message"] = Resources.DelegationController.RealmDeleted; return RedirectToAction("Configure", new { id = model.UserName }); } catch (ValidationException ex) { ModelState.AddModelError("", ex.Message); } catch { ModelState.AddModelError("", Resources.DelegationController.ErrorDeletingDelegationSetting); } var vm = new DelegationSettingsForUserViewModel(this.delegationRepository, this.userManagementRepository, model.UserName); return View("Configure", vm); }
public void Add(DelegationSetting setting) { NewContext.AddDelegation(setting.ToEntity()); }