public PartialViewResult PartialFinishVisit(int ActId) { var model = ActivityRep.Get(ActId); ViewBag.ProductId = new SelectList(ProductRep.FindBy(i => i.prod_group_id == 1), "id", "name"); var context = new CRMContext(); var PromoList = context.GetRemainsByPeriod(DateTime.Now.Month, DateTime.Now.Year).AsQueryable().Where(i => i.cuser_id == MyId && i.q_end > 0). Select(i => new Report_() { id = i.promo_id, name = i.promo_name + " - " + i.q_end + " шт." }); ViewBag.PromoList = new SelectList(PromoList, "id", "name"); return(PartialView(model)); }
public PartialViewResult Remains(PromoListViewModel obj) { var viewModel = new RemainsListViewModel(); viewModel.UserId = obj.UserId; viewModel.Search = obj.Search; viewModel.role = ""; if (User.IsInRole("admin") || User.IsInRole("seeAllUsers")) { viewModel.role = "seeAllUsers"; } CRMContext context = new CRMContext(); var model = context.GetRemainsByPeriod(obj.month_, obj.year_).AsQueryable().Where(viewModel.predicate).OrderBy(i => i.boss_name).ThenBy(i => i.cuser_name).ThenBy(i => i.promo_name).ToList(); if (obj.OrderParameter != null) { model = Ordering.OrderBy <GetRemainsByPeriod_Result>(model, obj.OrderParameter, obj.OrderDir).ToList(); } ViewBag.MyId = Convert.ToInt32(User.Identity.GetUserId()); ViewBag.Month_ = obj.month_; ViewBag.Year_ = obj.year_; return(PartialView(model)); }