public ResponseGetBranchInfo Get(RequestGetBranchInfo requestBranchInfo) { ResponseGetBranchInfo branch = new ResponseGetBranchInfo(); try { //Request.GetOwinContext(). CounslerModel counsler = Utils.Utils.GetCounslerFromRequest(Request.GetOwinContext()); if (counsler == null) { branch.Status = 3; branch.ErrorMsg = "couldn't find counsler"; } //ResponseGetBranchInfo branch = BranchModel.GetBranchesInfo(counsler, requestBranchInfo.LastSyncTime); branch = BranchModel.GetBranchesInfo(counsler, DateTime.MinValue); branch.Status = 1; } catch (Exception ex) { branch.Status = 2; branch.ErrorMsg = ex.Message; } return branch; }
internal static ResponseGetBranchInfo GetBranchesInfo(CounslerModel counsler, DateTime LastSyncTime) { ResponseGetBranchInfo response = new ResponseGetBranchInfo(); response.Branches = new List<BranchModel>(); //InMemoryHandler.Branches.Where(b => allowedBranches.Contains(b.BranchId)).ToList(); //TODO refresh the students here counsler.AllowedBranchedIds.ForEach(allowed => { response.Branches.AddRange(InMemoryHandler.Branches.Where(b => b.BranchId == allowed).ToList()); }); return response; }