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

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

    1: using Ia.Islamic.Koran.Wa.Models;
    2: using Microsoft.AspNetCore.Mvc;
    3: using System.Diagnostics;
    4: using System.Net;
    5:  
    6: namespace Ia.Islamic.Koran.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 KoranController : Controller
   28:     {
   29:         [HttpGet]
   30:         [Route("{iso2}")]
   31:         public IActionResult Index(string iso2)
   32:         {
   33:             var koranViewModel = new Ia.Islamic.Koran.Wa.Models.KoranViewModel();
   34:  
   35:             koranViewModel.Iso2 = iso2;
   36:  
   37:             return View("Index", koranViewModel);
   38:         }
   39:  
   40:         [HttpGet]
   41:         [Route("{iso2}/{chapterId}")]
   42:         public IActionResult Chapter(string iso2, string chapterId)
   43:         {
   44:             var koranViewModel = new Ia.Islamic.Koran.Wa.Models.KoranViewModel();
   45:  
   46:             koranViewModel.Iso2 = iso2;
   47:             koranViewModel.ChapterId = chapterId;
   48:  
   49:             return View("Chapter", koranViewModel);
   50:         }
   51:  
   52:         [HttpPost]
   53:         [Route("{iso2}/search")]
   54:         public IActionResult Search(string searchTextInput, string iso2)
   55:         {
   56:             var koranViewModel = new Ia.Islamic.Koran.Wa.Models.KoranViewModel();
   57:  
   58:             koranViewModel.Iso2 = iso2;
   59:             koranViewModel.SearchText = searchTextInput;
   60:  
   61:             koranViewModel.Translation = new Ia.Islamic.Cl.Model.Translation(iso2);
   62:  
   63:             var verseList = Ia.Islamic.Cl.Model.Business.Default.Search(WebUtility.HtmlEncode(searchTextInput), iso2, out Ia.Cl.Models.Result result);
   64:  
   65:             koranViewModel.VerseList = verseList;
   66:  
   67:             if (result.IsSuccessful)
   68:             {
   69:                 if (!result.HasWarning)
   70:                 {
   71:                     koranViewModel.SearchResultText = result.MessageWithoutCaption;
   72:                     koranViewModel.SearchResultCssClass = "success";
   73:                 }
   74:                 else
   75:                 {
   76:                     koranViewModel.SearchResultText = result.MessageWithoutCaption;
   77:                     koranViewModel.SearchResultCssClass = "warning";
   78:                 }
   79:             }
   80:             else
   81:             {
   82:                 koranViewModel.SearchResultText = result.MessageWithoutCaption;
   83:                 koranViewModel.SearchResultCssClass = "error";
   84:             }
   85:  
   86:             return View("Search", koranViewModel);
   87:         }
   88:  
   89:         [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
   90:         public IActionResult Error()
   91:         {
   92:             return View(new Ia.Islamic.Koran.Wa.Models.ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
   93:         }
   94:     }
   95: }