Пример #1
0
 public ActionResult Sphere()
 {
     if (!User.Identity.IsAuthenticated)
     {
         return(Redirect("~/Account/Login"));
     }
     else
     {
         var             currentUserId = User.Identity.GetUserId();
         Models.BigModel bigModel      = new Models.BigModel();
         bigModel.Act    = (from act in MainDb.Acts where act.UserId == currentUserId select act);
         bigModel.Sphere = (from sp in MainDb.Spheres where sp.UserId == currentUserId select sp);
         List <Models.BigModel> a = new List <Models.BigModel>();
         a.Add(bigModel);
         return(View(a));
     }
 }
Пример #2
0
 public ActionResult Index(int?sphere, int?impMin, int?impMax, DateTime?dateMin, DateTime?dateMax)
 {
     if (!User.Identity.IsAuthenticated)
     {
         return(Redirect("~/Account/Login"));
     }
     else
     {
         string          currentUserId = User.Identity.GetUserId();
         Models.BigModel bigModel      = new Models.BigModel();
         bigModel.Act = (from act in MainDb.Acts where act.UserId == currentUserId select act);
         if (sphere != null)
         {
             bigModel.Act = (from act in bigModel.Act where act.SphereId == sphere select act);
         }
         if (impMin != null)
         {
             bigModel.Act = (from act in bigModel.Act where act.Importance > impMin select act);
         }
         if (impMax != null)
         {
             bigModel.Act = (from act in bigModel.Act where act.Importance < impMax select act);
         }
         if (dateMin != null)
         {
             bigModel.Act = (from act in bigModel.Act where act.Date > dateMin select act);
         }
         if (dateMax != null)
         {
             bigModel.Act = (from act in bigModel.Act where act.Date < dateMax select act);
         }
         bigModel.Sphere = (from sp in MainDb.Spheres where sp.UserId == currentUserId select sp);
         List <Models.BigModel> a = new List <Models.BigModel>();
         a.Add(bigModel);
         return(View(a));
     }
 }