public ActionResult <GradelevelListViewModel> GetAllGradeLevels(GradelevelListViewModel gradelevel) { GradelevelListViewModel gradelevelList = new GradelevelListViewModel(); try { if (gradelevel.SchoolId > 0) { gradelevelList = _gradelevelService.GetAllGradeLevels(gradelevel); } else { gradelevelList._token = gradelevel._token; gradelevelList._tenantName = gradelevel._tenantName; gradelevelList._failure = true; gradelevelList._message = "Please enter valid scholl id"; } } catch (Exception es) { gradelevelList._failure = true; gradelevelList._message = es.Message; } return(gradelevelList); }
/// <summary> /// Get All GradeLevel /// </summary> /// <param name="gradelevelList"></param> /// <returns></returns> public GradelevelListViewModel GetAllGradeLevels(GradelevelListViewModel gradelevelList) { GradelevelListViewModel gradelevelListModel = new GradelevelListViewModel(); try { var gradelevelsList = this.context?.Gradelevels.Include(x => x.Equivalency) .Where(x => x.TenantId == gradelevelList.TenantId && x.SchoolId == gradelevelList.SchoolId).OrderBy(x => x.SortOrder).ToList(); if (gradelevelsList.Count > 0) { var gradeLevels = from gradelevel in gradelevelsList select new GradeLevelView() { GradeId = gradelevel.GradeId, LastUpdated = gradelevel.LastUpdated, NextGrade = this.context?.Gradelevels.FirstOrDefault(x => x.GradeId == gradelevel.NextGradeId)?.Title, NextGradeId = gradelevel.NextGradeId, SchoolId = gradelevel.SchoolId, Title = gradelevel.Title, ShortName = gradelevel.ShortName, SortOrder = gradelevel.SortOrder, TenantId = gradelevel.TenantId, GradeLevelEquivalency = gradelevel.Equivalency != null?gradelevel.Equivalency.GradeLevelEquivalency : null, EquivalencyId = gradelevel.EquivalencyId, AgeRangeId = gradelevel.AgeRangeId, IscedCode = gradelevel.IscedCode, //GradeDescription = gradelevel.IscedGradeLevelNavigation != null ? gradelevel.IscedGradeLevelNavigation.GradeDescription : null, //AgeRange=gradelevel.AgeRange, //EducationalStage=gradelevel.EducationalStage, //GradeLevelEquivalency=gradelevel.GradeLevelEquivalency, UpdatedBy = gradelevel.UpdatedBy }; gradelevelListModel.TableGradelevelList = gradeLevels.ToList(); gradelevelListModel._tenantName = gradelevelList._tenantName; gradelevelListModel._token = gradelevelList._token; gradelevelListModel._failure = false; } else { gradelevelListModel._tenantName = gradelevelList._tenantName; gradelevelListModel._token = gradelevelList._token; gradelevelListModel._failure = true; gradelevelListModel._message = NORECORDFOUND; } } catch (Exception es) { gradelevelListModel.TableGradelevelList = null; gradelevelListModel._message = es.Message; gradelevelListModel._failure = true; gradelevelListModel._tenantName = gradelevelList._tenantName; gradelevelListModel._token = gradelevelList._token; } return(gradelevelListModel); }
/// <summary> /// Get All GradeLevel /// </summary> /// <param name="gradelevel"></param> /// <returns></returns> public GradelevelListViewModel GetAllGradeLevels(GradelevelListViewModel gradelevel) { GradelevelListViewModel gradelevelList = new GradelevelListViewModel(); try { if (TokenManager.CheckToken(gradelevel._tenantName + gradelevel._userName, gradelevel._token)) { gradelevelList = this.gradelevelRepository.GetAllGradeLevels(gradelevel); } else { gradelevelList._failure = true; gradelevelList._message = TOKENINVALID; } } catch (Exception es) { gradelevelList._failure = true; gradelevelList._message = es.Message; } return(gradelevelList); }