コード例 #1
0
 public ActionResult Index()
 {
     var m = new VWindFarmsHome
     {
         TotalPublicWindFarms = _ctx.DWindFarms.Count(x => x.IsPublic || x.Author == User.Identity.Name),
         TotalPublicTurbines = _ctx.DTurbines.Count(x => x.IsPublic || x.Author == User.Identity.Name)
     };
     return View(m);
 }
コード例 #2
0
 public ActionResult List()
 {
     var m = new VWindFarmsHome();
     foreach (var db in _ctx.DTurbines.Where(x => x.IsPublic || x.Author == User.Identity.Name))
     {
         m.Turbines.Add(VTurbine.MapFromDb(db, User));
     }
     return View(m);
 }
コード例 #3
0
 public ActionResult List()
 {
     var m = new VWindFarmsHome();
     var sorted = _ctx.DWindFarms.Where(x => x.IsPublic || x.Author == User.Identity.Name).OrderByDescending(x => x.Rating);
     foreach (var db in sorted)
     {
         m.WindFarms.Add(VWindFarm.MapFromDb(db, User));
     }
     
     return View(m);
 }