public JsonResult GetCheckinProfiles() { if (CurrentDatabase.CheckinProfiles.Count() == 0) { CheckinProfilesModel.CreateDefault(CurrentDatabase); } var CheckinProfiles = CurrentDatabase.CheckinProfiles.ProjectTo <CheckinProfilesModel>(_config).ToList(); foreach (var item in CheckinProfiles) { item.CheckinProfileSettings = CurrentDatabase.CheckinProfileSettings .ProjectTo <CheckinProfileSettingsModel>(_config) .FirstOrDefault(c => c.CheckinProfileId == item.CheckinProfileId); } return(Json(CheckinProfiles, JsonRequestBehavior.AllowGet)); }
public ActionResult GetProfiles() { if (CurrentDatabase.CheckinProfiles.Count() == 0) { CheckinProfilesModel.CreateDefault(CurrentDatabase); } List <Profile> profiles = new List <Profile>(); List <CheckinProfileSetting> profileSettings = CurrentDatabase.CheckinProfileSettings.ToList(); foreach (CheckinProfileSetting settings in profileSettings) { Profile profile = new Profile(CurrentDatabase); profile.populate(settings); profiles.Add(profile); } return(Json(profiles, JsonRequestBehavior.AllowGet)); }