public async Task <TermVM> GetTermListAsync(int pageno, int pagesize, string sterm)
        {
            TermVM model    = new TermVM();
            var    parStart = new SqlParameter("@Start", (pageno - 1) * pagesize);
            var    parEnd   = new SqlParameter("@PageSize", pagesize);

            var parSearchTerm = new SqlParameter("@SearchTerm", DBNull.Value);

            if (!(sterm == null || sterm == ""))
            {
                parSearchTerm.Value = sterm;
            }
            // setting stored procedure OUTPUT value
            // This return total number of rows, and avoid two database call for data and total number of rows
            var spOutput = new SqlParameter
            {
                ParameterName = "@TotalCount",
                SqlDbType     = System.Data.SqlDbType.BigInt,
                Direction     = System.Data.ParameterDirection.Output
            };

            model.TermList = await objDB.Database.SqlQuery <TermView>("udspMstTermList @Start, @PageSize,@SearchTerm, @TotalCount out",
                                                                      parStart, parEnd, parSearchTerm, spOutput).ToListAsync();

            model.TotalRecords = int.Parse(spOutput.Value.ToString());
            return(model);
        }
Example #2
0
        public async Task EditTerm(TermVM term)
        {
            TermQueue termQueue = Mapper.Map <TermVM, TermQueue>(term, options => {
                options.AfterMap((src, dest) => dest.UserPerformingAction = this.UserId);
                options.AfterMap((src, dest) => dest.TenantId             = this.TenantId);
            });

            ProcessQueueHistory processQueueHistory = new ProcessQueueHistory()
            {
                Data      = JsonConvert.SerializeObject(termQueue),
                AddedById = this.UserId,
                TenantId  = this.TenantId,
                Status    = Data.Enums.ResultStatus.Waiting,
                Type      = Data.Enums.ProcessType.EditTerm
            };

            await this.queueHandler.AddToQueue(processQueueHistory);
        }
 public ActionResult TermList(int PageNo = 1, int PageSize = 10, string SearchTerm = "")
 {
     try
     {
         ViewBag.ActiveURL = "/Admin/Termlist";
         string    query    = "PageNo=" + PageNo + "&PageSize=" + PageSize + "&SearchTerm=" + SearchTerm;
         TermAPIVM apiModel = objAPI.GetRecordByQueryString <TermAPIVM>("configuration", "termlist", query);
         TermVM    model    = new TermVM();
         model.TermList   = apiModel.TermList;
         model.PagingInfo = new PagingInfo {
             CurrentPage = PageNo, ItemsPerPage = PageSize, TotalItems = apiModel.TotalRecords
         };
         if (Request.IsAjaxRequest())
         {
             return(PartialView("_pvTermList", model));
         }
         return(View(model));
     }
     catch (AuthorizationException)
     {
         TempData["ErrMsg"] = "Your Login Session has expired. Please Login Again";
         return(RedirectToAction("Login", "Account", new { Area = "" }));
     }
 }
Example #4
0
        public async Task <IActionResult> Edit([FromBody] TermVM term)
        {
            await this.TermService.EditTerm(term);

            return(Ok());
        }
Example #5
0
        public async Task <IActionResult> GetById(Guid id)
        {
            TermVM term = await this.TermService.GetTermById(id);

            return(Json(term));
        }