Changeset 6159


Ignore:
Timestamp:
05/07/11 14:37:12 (10 years ago)
Author:
gschwarz
Message:

#1433 Updated Problem Controller fixed bug in saveProblem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/ProblemController.cs

    r6153 r6159  
    7474            String problemDataTypeName = collection.Get("ProblemDataTypeName");
    7575            long problemClassId = long.Parse(collection.Get("ProblemClassId"));
    76             long plattformId = long.Parse(collection.Get("PlattformId"));
     76            long platformId = long.Parse(collection.Get("PlatformId"));
    7777
    7878            // Later, we will get the runs from the session ...
    7979            ProblemModel pm = new ProblemModel();
    80             pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(problemId)).FirstOrDefault();
     80            if( problemId != 0 )
     81                pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(problemId)).FirstOrDefault();
    8182
    8283            pm.Problem.Name = problemName;
     
    8485            pm.Problem.DataTypeName = problemDataTypeName;
    8586            pm.Problem.ProblemClassId = problemClassId;
    86             pm.Problem.PlatformId = plattformId;
     87            pm.Problem.PlatformId = platformId;
    8788
    8889            pm.SaveProblem(pm.Problem);
     
    9091            return View("Index",pm);
    9192        }
    92 
    93         //public ActionResult CreateProblem(FormCollection collection) {
    94         //    Problem problem = new Problem();
    95         //    String problemName = collection.Get("ProblemName");
    96         //    long problemClassId = long.Parse(collection.Get("ProblemClassId"));
    97         //    long plattformId = long.Parse(collection.Get("PlattformId"));
    98         //    problem.Name = problemName;
    99         //    problem.ProblemClassId = problemClassId;
    100         //    problem.PlatformId = plattformId;
    101         //    problem.DataTypeName = "";
    102         //    problem.DataTypeTypeName = "";
    103         //    problem.Description = "";
    104 
    105         //    // Later, we will get the runs from the session ..
    106         //    ProblemModel pm = new ProblemModel();
    107         //    pm.CreateProblem(problem);
    108 
    109         //    return View("Index", pm);
    110         //}
    111 
    11293  }
    11394}
Note: See TracChangeset for help on using the changeset viewer.