public async Task <IActionResult> GetMenu([FromHeader] string projectDomain) { WebMenuModel result = await _mediator.Send(new GetWebMenuQuery { ProjectDomain = projectDomain, }); return(Ok(result)); }
// GET: User public ActionResult Index(WebMenuModel model) { ViewBag.CurrentLang = CurrentLang; DateTime startDate = model.StartDate > DateTime.MinValue ? new DateTime(model.StartDate.Year, model.StartDate.Month, model.StartDate.Day, 0, 0, 0) : DateTime.MinValue; DateTime endDate = model.EndDate > DateTime.MinValue ? new DateTime(model.EndDate.Year, model.EndDate.Month, model.EndDate.Day, 23, 59, 59) : DateTime.MinValue; var data = _webMenu.DbQuery.Where(!string.IsNullOrEmpty(model.SearchText), o => o.Name.Contains(model.SearchText) || o.Code.Contains(model.SearchText)) .Where(model.ID > 0, o => o.ID == model.ID) .Where(startDate > DateTime.MinValue, o => o.Created >= startDate) .Where(endDate > DateTime.MinValue, o => o.Created <= endDate) .OrderByDescending(o => o.ID) .ToList(); ViewBag.Data = new List <WebMenu>() { new WebMenu() { ID = 1, Name = "Test", Code = "test", Type = "menu", Created = DateTime.Now, Content = "chưa có", LangID = 1, Activity = true, Files = "chưa có", ParentID = 0, Summary = "đây là thằng cha" }, new WebMenu() { ID = 2, Name = "Test2", Code = "test2", Type = "menu", Created = DateTime.Now, Content = "chưa có", LangID = 1, Activity = false, Files = "chưa có", ParentID = 0, Summary = "đây là thằng cha" } }; //;data.Skip(model.PageSize * model.PageIndex).Take(model.PageSize).ToList(); model.TotalRecord = data.Count; ViewBag.Model = model; return(View()); }