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

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

    1: using Ia.Islamic.Koran.Belief.Wa.Models;
    2: using Microsoft.AspNetCore.Http;
    3: using Microsoft.AspNetCore.Mvc;
    4: using System.Diagnostics;
    5:  
    6: namespace Ia.Islamic.Koran.Belief.Wa.Controllers
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     ///
   12:     /// </summary>
   13:     /// 
   14:     /// <remarks> 
   15:     /// Copyright � 2006-2025 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     ///
   17:     /// 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
   18:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   19:     ///
   20:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   21:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   22:     /// 
   23:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   24:     /// 
   25:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   26:     /// </remarks> 
   27:     public class HomeController : Controller
   28:     {
   29:         ////////////////////////////////////////////////////////////////////////////
   30:  
   31:         /// <summary>
   32:         ///
   33:         /// </summary>
   34:         public IActionResult Index()
   35:         {
   36:             var homeViewModel = new Ia.Islamic.Koran.Belief.Wa.Models.HomeViewModel();
   37:  
   38:             DataBind(ref homeViewModel);
   39:  
   40:             return View(homeViewModel);
   41:         }
   42:  
   43:         ////////////////////////////////////////////////////////////////////////////
   44:  
   45:         /// <summary>
   46:         ///
   47:         /// </summary>
   48:         private void DataBind(ref Ia.Islamic.Koran.Belief.Wa.Models.HomeViewModel homeViewModel)
   49:         {
   50:             string languageIso, domain;
   51:             Ia.Islamic.Cl.Model.Translation translation;
   52:             Ia.Islamic.Cl.Model.Ui.VerseTopicUi verseTopic;
   53:  
   54:             languageIso = "ja"; // Ia.Islamic.Koran.Belief.Wa.Models.Business.ReturnUserLanguage(this.Request);
   55:  
   56:             var verseTopicTask = Ia.Cl.Models.Http.GetAsync<Ia.Islamic.Cl.Model.Ui.VerseTopicUi>("https://api.krn.org", "api/islamic/koran/faith/calculated-verse/" + languageIso + "/some topic");
   57:             verseTopic = verseTopicTask.Result;
   58:  
   59:             if (verseTopic != null)
   60:             {
   61:                 homeViewModel.TopicVerseContent = verseTopic.Content;
   62:  
   63:                 translation = new Ia.Islamic.Cl.Model.Translation(languageIso);
   64:  
   65:                 homeViewModel.VerseUrl = "https://krn.org/" + languageIso + "/" + verseTopic.ChapterNumber + "#" + verseTopic.Number;
   66:                 homeViewModel.VerseText = "(" + verseTopic.ChapterNumber + ":" + verseTopic.Number + ")";
   67:  
   68:                 homeViewModel.SelfUrl = "";
   69:                 homeViewModel.SelfText = translation.MainTitle;
   70:  
   71:  
   72:                 // will rotate domain name if it is not explicitly "belief.krn.org" or "glaube.krn.org"
   73:                 domain = "domain";// Ia.Cl.Models.Default.BasicHost(this.Page.Request.Url);
   74:  
   75:                 /*
   76:                 if (domain != "belief.krn.org" && domain != "glaube.krn.org")
   77:                 {
   78:                     domain = Ia.Simple.Cl.Model.Data.Domain.DomainList("belief.krn.org").PickRandom().NameTld;
   79:                 }
   80:                 */
   81:  
   82:                 // below: some browsers will not call website again
   83:                 //homeViewModel.SelfUrl.Attributes["href"] = "https://" + domain + "?languageIso=" + languageIso + "&" + verseTopic.ChapterVerseNumber + ":" + verseTopic.NumberOfVerses;
   84:             }
   85:         }
   86:  
   87:         ////////////////////////////////////////////////////////////////////////////
   88:  
   89:         /// <summary>
   90:         ///
   91:         /// </summary>
   92:         [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
   93:         public IActionResult Error()
   94:         {
   95:             return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
   96:         }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:         ////////////////////////////////////////////////////////////////////////////
  100:     }
  101:  
  102:     ////////////////////////////////////////////////////////////////////////////
  103:     ////////////////////////////////////////////////////////////////////////////
  104: }