Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/27/11 19:09:49 (13 years ago)
Author:
jwolfing
Message:

#1433 code formatted

File:
1 edited

Legend:

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

    r6313 r6317  
    77using HLWebOKBAdminPlugin.OKBAdministrationService;
    88
    9 namespace HLWebOKBAdminPlugin.Controllers
    10 {
    11     public class PlatformController : Controller
    12     {
    13         //
    14         // GET: /Platform/
     9namespace HLWebOKBAdminPlugin.Controllers {
     10  public class PlatformController : Controller {
     11    //
     12    // GET: /Platform/
    1513
    16         public ActionResult Index()
    17         {
    18             Session["SelectedSubMenu"] = "Platform";
    19             PlatformModel plm = new PlatformModel();
    20             return View(plm);
    21         }//Index
     14    public ActionResult Index() {
     15      Session["SelectedSubMenu"] = "Platform";
     16      PlatformModel plm = new PlatformModel();
     17      return View(plm);
     18    }//Index
    2219
    2320
    24         public ActionResult Detail(long? id) {
    25             Session["SelectedSubMenu"] = "Platform";
    26             PlatformModel plm = new PlatformModel();
     21    public ActionResult Detail(long? id) {
     22      Session["SelectedSubMenu"] = "Platform";
     23      PlatformModel plm = new PlatformModel();
    2724
    28             if (id == null)
    29                 plm.Platform = new Platform();
    30             else
    31                 plm.Platform = (Platform)plm.Platforms.Where(x => x.Id.Equals((long)id)).FirstOrDefault();
    32             return View(plm);
    33         }//Detail
     25      if (id == null)
     26        plm.Platform = new Platform();
     27      else
     28        plm.Platform = (Platform)plm.Platforms.Where(x => x.Id.Equals((long)id)).FirstOrDefault();
     29      return View(plm);
     30    }//Detail
    3431
    35         public ActionResult Delete(long? id) {
    36             Session["SelectedSubMenu"] = "Platform";
     32    public ActionResult Delete(long? id) {
     33      Session["SelectedSubMenu"] = "Platform";
    3734
    38             PlatformModel plm = new PlatformModel();
    39             if (id != 0) {
    40                 plm.DeletePlatform((long)id);
    41             }
    42             return View("Index", plm);
    43         }//Delete
     35      PlatformModel plm = new PlatformModel();
     36      if (id != 0) {
     37        plm.DeletePlatform((long)id);
     38      }
     39      return View("Index", plm);
     40    }//Delete
    4441
    45         public ActionResult SaveChanges(FormCollection collection) {
    46             long platformId = long.Parse(collection.Get("PlatformId"));
    47             String platformName = collection.Get("PlatformName");
    48             String platformDescription = collection.Get("PlatformDescription");
     42    public ActionResult SaveChanges(FormCollection collection) {
     43      long platformId = long.Parse(collection.Get("PlatformId"));
     44      String platformName = collection.Get("PlatformName");
     45      String platformDescription = collection.Get("PlatformDescription");
    4946
    50             // Later, we will get the runs from the session ...
    51             PlatformModel plm = new PlatformModel();
    52             if (platformId != 0)
    53                 plm.Platform = (Platform)plm.Platforms.Where(x => x.Id.Equals(platformId)).FirstOrDefault();
     47      // Later, we will get the runs from the session ...
     48      PlatformModel plm = new PlatformModel();
     49      if (platformId != 0)
     50        plm.Platform = (Platform)plm.Platforms.Where(x => x.Id.Equals(platformId)).FirstOrDefault();
    5451
    55             plm.Platform.Name = platformName;
    56             plm.Platform.Description = platformDescription;
     52      plm.Platform.Name = platformName;
     53      plm.Platform.Description = platformDescription;
    5754
    58             plm.SavePlatform(plm.Platform);
     55      plm.SavePlatform(plm.Platform);
    5956
    60             return View("Index", plm);
    61         }//SaveChanges
     57      return View("Index", plm);
     58    }//SaveChanges
    6259
    63         public ActionResult SortAsc() {
    64             Session["SelectedSubMenu"] = "Platform";
    65             PlatformModel plm = new PlatformModel();
    66             plm.Platforms = plm.Platforms.OrderBy(x => x.Name).ToList<Platform>();
    67             return View("Index", plm);
    68         }
     60    public ActionResult SortAsc() {
     61      Session["SelectedSubMenu"] = "Platform";
     62      PlatformModel plm = new PlatformModel();
     63      plm.Platforms = plm.Platforms.OrderBy(x => x.Name).ToList<Platform>();
     64      return View("Index", plm);
     65    }
    6966
    70         /// <summary>
    71         /// Controller for Index View
    72         /// </summary>
    73         /// <returns></returns>
    74         public ActionResult SortDesc() {
    75             Session["SelectedSubMenu"] = "Platform";
    76             PlatformModel plm = new PlatformModel();
     67    /// <summary>
     68    /// Controller for Index View
     69    /// </summary>
     70    /// <returns></returns>
     71    public ActionResult SortDesc() {
     72      Session["SelectedSubMenu"] = "Platform";
     73      PlatformModel plm = new PlatformModel();
    7774
    78             IOrderedEnumerable<Platform> plmOrderedList = plm.Platforms.OrderByDescending(x => x.Name);
    79             IList<Platform> plmList = new List<Platform>();
    80             foreach (var item in plmOrderedList) {
    81                 plmList.Add(item);
    82             }
    83             plm.Platforms = plmList;
     75      IOrderedEnumerable<Platform> plmOrderedList = plm.Platforms.OrderByDescending(x => x.Name);
     76      IList<Platform> plmList = new List<Platform>();
     77      foreach (var item in plmOrderedList) {
     78        plmList.Add(item);
     79      }
     80      plm.Platforms = plmList;
    8481
    85             // this should be the right code
    86             //pm.Problems = pm.Problems.OrderByDescending(x => x.Name).ToArray<Problem>();
    87             return View("Index", plm);
    88         }
     82      // this should be the right code
     83      //pm.Problems = pm.Problems.OrderByDescending(x => x.Name).ToArray<Problem>();
     84      return View("Index", plm);
    8985    }
     86  }
    9087}
Note: See TracChangeset for help on using the changeset viewer.