Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBAdminPlugin/Models/PlatformModel.cs @ 6479

Last change on this file since 6479 was 6317, checked in by jwolfing, 13 years ago

#1433 code formatted

File size: 2.1 KB
RevLine 
[6310]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using HLWebOKBAdminPlugin.OKBAdministrationService;
6using HLWebOKBAdminPlugin.Helpers;
7
8namespace HLWebOKBAdminPlugin.Models {
[6317]9  public class PlatformModel {
10    public String SelectedSubMenu { get; set; }
11    public IList<Platform> Platforms {
12      get { return PlatformGetAll(); }
13      set { ;}
14    }
[6310]15
[6317]16    public Platform Platform { get; set; }
[6310]17
[6317]18    public PlatformModel() {
19      Platform = new Platform();
20    }//PlatformModel
[6310]21
[6317]22    //***************************************Platform Class**********************************************
23    private IList<Platform> PlatformGetAll() {
24      AdministrationServiceClient adminClient = Admin.GetClientFactory();
[6310]25
[6317]26      IList<Platform> platformList = new List<Platform>();
[6310]27
[6317]28      if (adminClient != null) {
29        Platform[] platforms = adminClient.GetPlatforms();
30        foreach (Platform pl in platforms) {
31          platformList.Add(pl);
32        }
33      }//if (adminClient != null)
[6310]34
[6317]35      return platformList;
36    }//ProblemClassGetAll               
[6310]37
[6317]38    private long AddPlatform(Platform plattform) {
39      AdministrationServiceClient adminClient = Admin.GetClientFactory();
[6310]40
[6317]41      if (adminClient != null) {
42        return adminClient.AddPlatform(plattform);
43      }
[6310]44
[6317]45      return 0;
46    }//AddPlatform
[6310]47
[6317]48    public void DeletePlatform(long id) {
49      AdministrationServiceClient adminClient = Admin.GetClientFactory();
[6310]50
[6317]51      if (adminClient != null) {
52        adminClient.DeletePlatform(id);
53      }
54    }//DeletePlatform
[6310]55
[6317]56    public long SavePlatform(Platform platform) {
57      AdministrationServiceClient adminClient = Admin.GetClientFactory();
[6310]58
[6317]59      if (adminClient != null) {
60        if (platform.Id == 0) {
61          return AddPlatform(platform);
62        } else {
63          Platform pl = adminClient.GetPlatform(platform.Id);
[6310]64
[6317]65          if (pl != null) {
66            adminClient.UpdatePlatform(platform);
67            return platform.Id;
68          }
69        }
70      }
[6310]71
[6317]72      return 0;
73    }//SavePlatform       
74  }
[6310]75}
Note: See TracBrowser for help on using the repository browser.