public ActionResult Add(AddDelegationModel model)
        {
            if (!ModelState.IsValid)
            {
                return View();
            }

            var setting = new DelegationModel
            {
                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");
        }
예제 #2
0
        public void Add(DelegationModel model)
        {
            var doc = new Delegation
            {
                UserName = model.UserName,
                Realm = model.Realm.AbsoluteUri,
                Description = model.Description
            };

            _session.Store(doc);
        }
예제 #3
0
 public void Delete(DelegationModel model)
 {
     var doc = _session.Load<Delegation>(model.Id);
     _session.Delete(doc);
 }