Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/11 15:35:44 (13 years ago)
Author:
gschwarz
Message:

#1433 Updated Problem Control/View

File:
1 edited

Legend:

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

    r6159 r6162  
    2525    }
    2626
     27        /// <summary>
     28        /// Controller for Index View
     29        /// </summary>
     30        /// <returns></returns>
    2731        public ActionResult SortAsc() {
    2832            Session["SelectedSubMenu"] = "Problem";
    2933            ProblemModel pm = new ProblemModel();
    30             pm.Problems.OrderBy(x => x.Name);
     34            pm.Problems = pm.Problems.OrderBy(x => x.Name).ToList<Problem>();
    3135            return View("Index",pm);
    3236        }
    3337
     38        /// <summary>
     39        /// Controller for Index View
     40        /// </summary>
     41        /// <returns></returns>
    3442        public ActionResult SortDesc() {
    3543            Session["SelectedSubMenu"] = "Problem";
    3644            ProblemModel pm = new ProblemModel();
    37             pm.Problems.OrderByDescending(x => x.Name);
     45            pm.Problems = pm.Problems.OrderByDescending(x => x.Name).ToArray<Problem>();
    3846            return View("Index",pm);
    3947        }
     
    5664    }
    5765
     66        /// <summary>
     67        /// Controller for Index View
     68        /// </summary>
     69        /// <returns></returns>
    5870        public ActionResult Delete(long id) {
    5971            Session["SelectedSubMenu"] = "Problem";
     
    6274            ProblemModel pm = new ProblemModel();
    6375            if(id != 0) {
    64                 pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(id)).FirstOrDefault();
    65 //                pm.DeleteProblem();
     76                pm.DeleteProblem(id);
    6677            }
    67             return View(pm);
     78            return View("Index", pm);
    6879        }
    6980
     81        /// <summary>
     82        /// Controller for Detail View
     83        /// </summary>
     84        /// <returns></returns>
    7085        public ActionResult SaveChanges(FormCollection collection) {           
    7186            long problemId = long.Parse(collection.Get("ProblemId"));
     
    7893            // Later, we will get the runs from the session ...
    7994            ProblemModel pm = new ProblemModel();
    80             if( problemId != 0 )
     95            if(problemId != 0)
    8196                pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(problemId)).FirstOrDefault();
    8297
     
    8499            pm.Problem.Description = problemDescription;
    85100            pm.Problem.DataTypeName = problemDataTypeName;
     101            pm.Problem.DataTypeTypeName = "";
    86102            pm.Problem.ProblemClassId = problemClassId;
    87103            pm.Problem.PlatformId = platformId;
Note: See TracChangeset for help on using the changeset viewer.