public JsonResult CreateCheckinProfile() { var CheckinProfile = new CheckinProfilesModel() { CheckinProfileSettings = new CheckinProfileSettingsModel() }; return(Json(CheckinProfile, JsonRequestBehavior.AllowGet)); }
private CheckinProfile MapCheckinProfile(CheckinProfilesModel json) { CheckinProfile checkinProfile; if (json.CheckinProfileId == 0) { checkinProfile = new CheckinProfile(); } else { checkinProfile = CurrentDatabase.CheckinProfiles.FirstOrDefault(c => c.CheckinProfileId == json.CheckinProfileId); } checkinProfile.Name = json.Name; return(checkinProfile); }
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)); }