예제 #1
0
 public ActionResult NewTraining(SkierModel skierModel)
 {
     ViewBag.history = String.Empty;
     // ViewBag.thisTraining = String.Empty;
     history = (Dictionary <uint, List <SkierModel> >)TempData["history"];
     if (ModelState.IsValid)
     {
         skierModel.calcDay = SkierTools.GetDayRunDistanse(skierModel.distFirstDay, skierModel.persentBoost, skierModel.calcDist);
         if (!history.ContainsKey((uint)skierModel.id))
         {
             history.Add((uint)skierModel.id, new List <SkierModel>()
             {
                 skierModel
             });
         }
         else
         {
             history[(uint)skierModel.id].Add(skierModel);
         }
         ViewBag.thisTraining = SkierTools.ListFormatingStrHistoryRu(history[(uint)skierModel.id]);
     }
     else
     {
         if (history.ContainsKey((uint)skierModel.id))
         {
             ViewBag.thisTraining = SkierTools.ListFormatingStrHistoryRu(history[(uint)skierModel.id]);
         }
     }
     TempData["history"] = history;
     return(View(skierModel));
 }
예제 #2
0
        public ActionResult NewTraining(uint?id)
        {
            ViewBag.thisTraining = String.Empty;
            history             = (Dictionary <uint, List <SkierModel> >)TempData["history"];
            TempData["history"] = history;
            SkierModel sk = new SkierModel();

            if (id.HasValue)
            {
                if (history.ContainsKey((uint)id))
                {
                    if (history[(uint)id].Count != 0)
                    {
                        sk.id   = id;
                        sk.name = history[(uint)id][0].name;
                        ViewBag.thisTraining = SkierTools.ListFormatingStrHistoryRu(history[(uint)id]);
                    }
                }
            }
            return(View(sk));
        }