public static void SaveAuditEntry(string type, string note, string userName = null, string organizationName = null) { using (TemplateDatabaseDataSource tdb = new TemplateDatabaseDataSource()) { CreateAuditEntry(tdb, type, note, userName, organizationName); tdb.SaveChanges(); } }
public static void Delete(LookupGreenTemplate lookupGreenTemplate) { using (TemplateDatabaseDataSource tdb = new TemplateDatabaseDataSource()) { GreenTemplate greenTemplate = tdb.GreenTemplates.Single(y => y.Id == lookupGreenTemplate.Id); // Remove all green constraints associated with the green template greenTemplate.ChildGreenConstraints.ToList().ForEach(y => tdb.GreenConstraints.DeleteObject(y)); // Remove the green template tdb.GreenTemplates.DeleteObject(greenTemplate); tdb.SaveChanges(); } }
public ActionResult SaveProfile(UserProfile aProfile) { using (DB.TemplateDatabaseDataSource tdb = new TemplateDatabaseDataSource()) { DB.User lUser = CheckPoint.Instance.GetUser(tdb); lUser.Use(u => { u.FirstName = aProfile.firstName; u.LastName = aProfile.lastName; u.Phone = aProfile.phone; u.Email = aProfile.email; u.OkayToContact = aProfile.okayToContact; u.ExternalOrganizationName = aProfile.organization; u.ExternalOrganizationType = aProfile.organizationType; u.ApiKey = aProfile.apiKey; }); tdb.SaveChanges(); return(ProfileData()); } }