Changeset 6153 for branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/ProblemController.cs
- Timestamp:
- 05/07/11 14:17:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Controllers/ProblemController.cs
r6142 r6153 25 25 } 26 26 27 public ActionResult SortAsc() { 28 Session["SelectedSubMenu"] = "Problem"; 29 ProblemModel pm = new ProblemModel(); 30 pm.Problems.OrderBy(x => x.Name); 31 return View("Index",pm); 32 } 33 34 public ActionResult SortDesc() { 35 Session["SelectedSubMenu"] = "Problem"; 36 ProblemModel pm = new ProblemModel(); 37 pm.Problems.OrderByDescending(x => x.Name); 38 return View("Index",pm); 39 } 27 40 /// <summary> 28 41 /// Controller for Detail View … … 30 43 /// <param name="p"></param> 31 44 /// <returns></returns> 32 public ActionResult Detail(long id)45 public ActionResult Detail(long? id) 33 46 { 34 47 Session["SelectedSubMenu"] = "Problem"; … … 36 49 // we can also use the Problem class. (?) 37 50 ProblemModel pm = new ProblemModel(); 38 if(id == 0)51 if(id == null) 39 52 pm.Problem = new Problem(); 40 53 else 41 pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals( id)).FirstOrDefault();54 pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals((long)id)).FirstOrDefault(); 42 55 return View(pm); 43 56 } 57 58 public ActionResult Delete(long id) { 59 Session["SelectedSubMenu"] = "Problem"; 60 // We use here the ProblemMode, but I think 61 // we can also use the Problem class. (?) 62 ProblemModel pm = new ProblemModel(); 63 if(id != 0) { 64 pm.Problem = (Problem)pm.Problems.Where(x => x.Id.Equals(id)).FirstOrDefault(); 65 // pm.DeleteProblem(); 66 } 67 return View(pm); 68 } 44 69 45 70 public ActionResult SaveChanges(FormCollection collection) {
Note: See TracChangeset
for help on using the changeset viewer.