public static Models.DisabilityCategoryModel GetDisabilityCategory(int disabilityCategoryID) { var dataItem = GetContext().GetDisabilityCategory(disabilityCategoryID).Single(); var result = new Models.DisabilityCategoryModel { ID = dataItem.ID, Active = dataItem.Active, Description = dataItem.Description }; return(result); }
public static void UpdateDisabilityCategory(DisabilityCategoryModel disabilityCategory, int userId) { using (var context = DataContext.GetContext()) { var existing = context.DisabilityCategories.Single(a => a.ID == disabilityCategory.ID); existing.Description = disabilityCategory.Description; existing.Active = disabilityCategory.Active; existing.LastModifiedOn = DateTime.Now; existing.LastModifiedBy = userId; context.SaveChanges(); } }
public static void InsertDisabilityCategory(DisabilityCategoryModel disabilityCategory, int userId) { using (var context = DataContext.GetContext()) { context.DisabilityCategories.AddObject(new Entities.DisabilityCategory { Active = true, CreatedBy = userId, CreatedOn = DateTime.Now, Description = disabilityCategory.Description, LastModifiedBy = userId, LastModifiedOn = DateTime.Now }); context.SaveChanges(); } }
public static Models.DisabilityCategoryModel GetDisabilityCategory(int disabilityCategoryID) { var dataItem = GetContext().GetDisabilityCategory(disabilityCategoryID).Single(); var result = new Models.DisabilityCategoryModel { ID = dataItem.ID, Active = dataItem.Active, Description = dataItem.Description }; return result; }
public static void SaveDisabilityCategory(Models.DisabilityCategoryModel disabilityCategory) { GetContext().SaveDisabilityCategory(disabilityCategory.ID, disabilityCategory.Description, disabilityCategory.Active); }