public async Task <ActionResult> Summary3Async(string view) { var reslut = await Task.Factory.StartNew(() => { var db = new BaseRepository(); DateTime year = new DateTime(DateTime.Today.Year, 1, 1); ViewDataDictionary model = new ViewDataDictionary(); model["今天调入头数"] = db.GetCount <tbPig>(p => p.grantDate == DateTime.Today) == 0 ? 0 : db.GetEntities <tbPig>(p => p.grantDate == DateTime.Today).Sum(p => p.grantNum); model["今天销售头数"] = db.GetCount <tbSales>(p => p.salesDate == DateTime.Today) == 0 ? 0 : db.GetEntities <tbSales>(p => p.salesDate == DateTime.Today).Sum(p => p.salesNum); model["今天死亡头数"] = db.GetCount <tbDeath>(p => p.deathDate == DateTime.Today) == 0 ? 0 : db.GetEntities <tbDeath>(p => p.deathDate == DateTime.Today).Sum(p => p.deathNum); model["今天发料包数"] = GrantFeed.GetBagNum(DateTime.Today, DateTime.Today); model["今天疫苗注射户数"] = db.GetCount <VaccineTask>(p => p.injectDate.Date == DateTime.Today.Date); return(model); }); ViewData = reslut; return(PartialView()); }
public ActionResult FeedReport(int?id, string raiserID) { var db = new FarmRepository(); GrantFeed model = null; if (id.HasValue) { model = db.GetEntitie <GrantFeed>(p => p.ID == id.Value); } else { model = db.GetEntities <GrantFeed>(p => p.raiserID == raiserID).OrderByDescending(p => p.referTime).FirstOrDefault(); } if (model == null) { return(HttpNotFound()); } return(View("GrantReport", model)); }