)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » HomeController (Ia.Learning.Manhag.Wa.Controllers)

Public general use code classes and xml files that we've compiled and used over the years:

    1: using Microsoft.AspNetCore.Mvc;
    2: using System.Diagnostics;
    3: using Ia.Learning.Manhag.Wa.Models;
    4: using Ia.Learning.Manhag.Wa.Models.Home;
    5: using Microsoft.EntityFrameworkCore.Diagnostics;
    6:  
    7: namespace Ia.Learning.Manhag.Wa.Controllers
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     ///
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright � 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     ///
   18:     /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     public class HomeController : Controller
   29:     {
   30:         private readonly ILogger<HomeController> _logger;
   31:  
   32:         ////////////////////////////////////////////////////////////////////////////
   33:  
   34:         /// <summary>
   35:         ///
   36:         /// </summary>
   37:         public HomeController(ILogger<HomeController> logger)
   38:         {
   39:             _logger = logger;
   40:         }
   41:  
   42:         ////////////////////////////////////////////////////////////////////////////
   43:  
   44:         /// <summary>
   45:         ///
   46:         /// </summary>
   47:         public IActionResult Index()
   48:         {
   49:             var indexViewModel = new Ia.Learning.Manhag.Wa.Models.Home.IndexViewModel();
   50:  
   51:             indexViewModel.LevelList = Ia.Learning.Cl.Models.MoeBook.LevelList;
   52:  
   53:             return View(indexViewModel);
   54:         }
   55:  
   56:         ////////////////////////////////////////////////////////////////////////////
   57:  
   58:         /// <summary>
   59:         ///
   60:         /// </summary>
   61:         [Route("level")]
   62:         public IActionResult Level(string id)
   63:         {
   64:             var indexViewModel = new Ia.Learning.Manhag.Wa.Models.Home.IndexViewModel();
   65:  
   66:             indexViewModel.LevelList = Ia.Learning.Cl.Models.MoeBook.LevelList;
   67:  
   68:             indexViewModel.GradeList = (from g in Ia.Learning.Cl.Models.MoeBook.GradeList where g.LevelId == id select g).ToList();
   69:  
   70:             indexViewModel.SelectedId = id;
   71:  
   72:             return View(indexViewModel);
   73:         }
   74:  
   75:         ////////////////////////////////////////////////////////////////////////////
   76:  
   77:         /// <summary>
   78:         ///
   79:         /// </summary>
   80:         [Route("grade")]
   81:         public IActionResult Grade(string id)
   82:         {
   83:             var indexViewModel = new Ia.Learning.Manhag.Wa.Models.Home.IndexViewModel();
   84:  
   85:             indexViewModel.LevelList = Ia.Learning.Cl.Models.MoeBook.LevelList;
   86:  
   87:             indexViewModel.GradeList = (from l in Ia.Learning.Cl.Models.MoeBook.GradeList where l.LevelId == Ia.Learning.Cl.Models.MoeBook.LevelIdFromGradeId(id) select l).ToList();
   88:  
   89:             indexViewModel.PeriodList = (from t in Ia.Learning.Cl.Models.MoeBook.PeriodList where t.GradeId == id select t).ToList();
   90:  
   91:             indexViewModel.SelectedId = id;
   92:  
   93:             return View(indexViewModel);
   94:         }
   95:  
   96:         ////////////////////////////////////////////////////////////////////////////
   97:  
   98:         /// <summary>
   99:         ///
  100:         /// </summary>
  101:         [Route("period")]
  102:         public IActionResult Period(string id)
  103:         {
  104:             var indexViewModel = new Ia.Learning.Manhag.Wa.Models.Home.IndexViewModel();
  105:  
  106:             indexViewModel.LevelList = Ia.Learning.Cl.Models.MoeBook.LevelList;
  107:  
  108:             indexViewModel.GradeList = (from l in Ia.Learning.Cl.Models.MoeBook.GradeList where l.LevelId == Ia.Learning.Cl.Models.MoeBook.LevelIdFromPeriodId(id) select l).ToList();
  109:  
  110:             indexViewModel.PeriodList = (from t in Ia.Learning.Cl.Models.MoeBook.PeriodList where t.GradeId == Ia.Learning.Cl.Models.MoeBook.GradeIdFromPeriodId(id) select t).ToList();
  111:  
  112:             indexViewModel.CourseList = (from t in Ia.Learning.Cl.Models.MoeBook.CourseList where t.PeriodId == id select t).ToList();
  113:  
  114:             indexViewModel.SelectedId = id;
  115:  
  116:             return View(indexViewModel);
  117:         }
  118:  
  119:         ////////////////////////////////////////////////////////////////////////////
  120:  
  121:         /// <summary>
  122:         ///
  123:         /// </summary>
  124:         [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
  125:         public IActionResult Error()
  126:         {
  127:             return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
  128:         }
  129:  
  130:         ////////////////////////////////////////////////////////////////////////////
  131:         ////////////////////////////////////////////////////////////////////////////
  132:     }
  133:  
  134:     ////////////////////////////////////////////////////////////////////////////
  135:     ////////////////////////////////////////////////////////////////////////////
  136: }