public ActionResult EditcpyNames(int id, FormCollection form) { CompanyGame cpy = new CompanyGame() { Id = id }; cpy = CompanyGameBll.LoadEntities(c => c.Id == id).FirstOrDefault(); cpy.GameName = form["gameName"]; cpy.Type = form["type"]; cpy.Url = form["url"]; if (CompanyGameBll.Update(cpy)) { return(Content("ok")); } else { return(Content("no")); } }
public ActionResult CpyNameEdit(int id) { ViewData.Model = CompanyGameBll.LoadEntities(r => r.Id == id).FirstOrDefault(); return(View()); }
public ActionResult GetAllCompanyInfos() { int pageSize = Request["rows"] == null ? 20 : int.Parse(Request["rows"]); int pageIndex = Request["page"] == null ? 1 : int.Parse(Request["page"]); int total = 0; var cpy = CompanyBll.LoadEntities(C => C.DelFlag == null || C.DelFlag == 0).Select(c => new { c.Id, c.UName, c.DelFlag, c.SystemName, c.Email, c.CompanyName, c.Phone, c.InTime, c.State, c.Rec_Index, c.Rec_Index_Time, c.Rec_Forum_Index, c.Rec_Forum_Index_Time }); var cpygame = CompanyGameBll.LoadEntities(c => c.Id > 0); var rech = RechargeBll.LoadEntities(r => r.Id > 0); var query = from c in cpy let Games = (from g in cpygame where c.Id == g.CompanyId select g).Count() //id对应的游戏总个数 let Total = (from r in rech where c.Id == r.CompanyId select(int?) r.Num - r.Used).Sum() //剩下的开服条数 select new { c.Id, c.UName, c.DelFlag, c.SystemName, c.Email, c.CompanyName, c.Phone, c.InTime, c.State, Games = Games, Total = Total ?? 0, c.Rec_Index, c.Rec_Index_Time, c.Rec_Forum_Index, c.Rec_Forum_Index_Time, // g.CompanyId, }; string uName = Request["uName"]; string systemName = Request["systemName"]; string companyName = Request["companyName"]; string rec = Request["rec"]; string rec_index = Request["rec_index"]; if (!string.IsNullOrEmpty(uName)) { query = query.Where(q => q.UName.Contains(uName)); } if (!string.IsNullOrEmpty(systemName)) { query = query.Where(q => q.SystemName.Contains(systemName)); } if (!string.IsNullOrEmpty(companyName)) { query = query.Where(q => q.CompanyName.Contains(companyName)); } if (!string.IsNullOrEmpty(rec))//频道 { query = query.Where(q => q.Rec_Forum_Index.Contains(rec)); } if (!string.IsNullOrEmpty(rec_index))//shouye { query = query.Where(q => q.Rec_Index.Contains(rec_index)); } total = query.Count(); var allData = query.OrderByDescending(d => d.Id) .Skip(pageSize * (pageIndex - 1)) .Take(pageSize).ToList(); var result = new { total = total, rows = allData }; return(Json(result, JsonRequestBehavior.AllowGet)); }