public ActionResult CreateOuTemplate(Guid id) { try { LcpsAdsOu ou = new LcpsAdsOu(id); OUTemplate t = new OUTemplate(); t.OUId = id; t.TemplateName = ou.Name; t.Description = ou.Description; DbContext.OUTemplates.Add(t); DbContext.SaveChanges(); return Content("Success", "text/html"); } catch (Exception ex) { AnvilExceptionCollector ec = new AnvilExceptionCollector(ex); return Content(ec.ToUL(), "text/html"); } }
public LcpsAdsOu GetOu() { bool refresh = false; if (_ou == null) refresh = true; if (_ou != null && (!_ou.ObjectGuid.Equals(OUId))) refresh = true; if (refresh) { try { _ou = new LcpsAdsOu(OUId); } catch (Exception ex) { throw new Exception(string.Format("{0} is an invalid OU", OUId.ToString()), ex); } } return _ou; }