コード例 #1
0
        public ResultViewModel <IEnumerable <LevelSerachViewModel> > GetList(int level = 1, int ParentID = 1)
        {
            ResultViewModel <IEnumerable <LevelSerachViewModel> > result
                = new ResultViewModel <IEnumerable <LevelSerachViewModel> >();


            try
            {
                if (level == 1)
                {
                    result.Data = mainCategoryService.GetAll().Select(i => i.TolevelSerachViewModel());
                    //main
                }
                else if (level == 2)
                {
                    //sub
                    result.Data = subCategoryService.Get(i => i.MainCategoryID == ParentID).Select(i => i.TolevelSerachViewModel());
                }
                else
                {
                    //track
                    result.Data = trackService.Get(i => i.SubCategoryID == ParentID).Select(i => i.TolevelSerachViewModel());
                }
                result.Successed = true;
            }
            catch
            {
                result.Successed = false;
            }
            return(result);
        }
コード例 #2
0
 public ActionResult <List <Track> > Get() =>
 _trackService.Get();