// GET: Categories public async Task<ActionResult> Index() { var culture = System.Threading.Thread.CurrentThread.CurrentUICulture.Name.ToLowerInvariant(); var model = new PageContentViewModel(); SqlConnectionCommon.Open(); var data = SqlConnectionCommon.Query<Language>("LanguageGetAll", new { culture }, commandType: CommandType.StoredProcedure); SqlConnectionCommon.Close(); var languages = data.ToList(); model.PageContents = languages.Select(language => new PageContent { Language = language.LCIDForLocale }).ToList(); return View(model); }
public ActionResult LoadDataContent(int page, int size, int code, string type, string content) { var model = new PageContentViewModel(); var paramss = new DynamicParameters(); paramss.Add("page", page); paramss.Add("size", size); paramss.Add("code", code); paramss.Add("type", type); paramss.Add("content", content); paramss.Add("out", dbType: DbType.Int32, direction: ParameterDirection.Output); SqlConnectionCommon.Open(); var data = SqlConnectionCommon.Query<PageContent>("PageContentFilter", paramss, commandType: CommandType.StoredProcedure); SqlConnectionCommon.Close(); model.PageContents = data.ToList(); var total = paramss.Get<int>("out"); model.TotalRecords = total; var totalTemp = Convert.ToDecimal(model.TotalRecords) / Convert.ToDecimal(size); var totalPages = Convert.ToInt32(Math.Ceiling(totalTemp)); model.TotalPages = totalPages; model.CurrentPage = page; model.PageSize = size; return PartialView("Partial/_PageContentPartial", model); }