示例#1
0
 public BackendTournamentViewModelItem()
 {
     Event  = new BackendEventViewModelItem();
     Game   = new BackendGameViewModelItem();
     Player = new List <BackendUserViewModelItem>();
     Teams  = new List <BackendTournamentTeamViewModelItem>();
 }
示例#2
0
        public static BackendGameViewModelItem FromModel(this BackendGameViewModelItem viewmodel, TournamentGame model)
        {
            viewmodel.ID               = model.ID;
            viewmodel.Name             = model.Name;
            viewmodel.ImagePath        = model.Image;
            viewmodel.RulesPath        = model.Rules;
            viewmodel.RequireSteamID   = model.RequireSteamID;
            viewmodel.RequireBattleTag = model.RequireBattleTag;

            return(viewmodel);
        }
示例#3
0
        public static TournamentGame ToModel(this BackendGameViewModelItem viewmodel)
        {
            TournamentGame model = new TournamentGame();

            model.ID               = viewmodel.ID;
            model.Name             = viewmodel.Name;
            model.Image            = viewmodel.ImagePath;
            model.Rules            = viewmodel.RulesPath;
            model.RequireBattleTag = viewmodel.RequireBattleTag;
            model.RequireSteamID   = viewmodel.RequireSteamID;

            return(model);
        }
示例#4
0
        public IHttpActionResult Backend_Detail_Insert(BackendGameViewModelItem request)
        {
            BackendGameViewModel viewmodel = new BackendGameViewModel();

            try
            {
                // TODO
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel));
        }
示例#5
0
        public IHttpActionResult Backend_Detail_Update(Int32 id, BackendGameViewModelItem request)
        {
            BackendGameViewModel         viewmodel = new BackendGameViewModel();
            TournamentGameDataController dataCtrl  = new TournamentGameDataController();

            try
            {
                var data = dataCtrl.Update(request.ToModel());
                viewmodel.Data.FromModel(data);
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel, "Eintrag wurde gespeichert."));
        }
示例#6
0
        public static Dictionary <string, InputInformation> GetForm()
        {
            Dictionary <string, InputInformation> result = new Dictionary <string, InputInformation>();

            result.Add("ID", new InputInformation()
            {
                Type = InputInformationType.integer, Readonly = true
            });
            result.Add("ChallongeLink", new InputInformation()
            {
                Type = InputInformationType.@string
            });
            result.Add("Mode", new InputInformation()
            {
                Type = InputInformationType.@string, Required = true
            });
            result.Add("TeamSize", new InputInformation()
            {
                Type = InputInformationType.integer, Required = true
            });
            result.Add("Start", new InputInformation()
            {
                Type = InputInformationType.datetime, Required = true
            });
            result.Add("End", new InputInformation()
            {
                Type = InputInformationType.datetime
            });

            result.Add("Event", new InputInformation()
            {
                Type = InputInformationType.reference, Reference = "Event", ReferenceForm = Form.GetReferenceForm(BackendEventViewModelItem.GetForm()), Required = true
            });
            result.Add("Game", new InputInformation()
            {
                Type = InputInformationType.reference, Reference = "Game", ReferenceForm = Form.GetReferenceForm(BackendGameViewModelItem.GetForm()), Required = true
            });
            result.Add("Player", new InputInformation()
            {
                Type = InputInformationType.referenceButton, Reference = "User", ReferenceForm = Form.GetReferenceForm(BackendUserViewModelItem.GetForm())
            });
            result.Add("Teams", new InputInformation()
            {
                Type = InputInformationType.referenceButton, Reference = "Team", ReferenceForm = Form.GetReferenceForm(BackendTournamentTeamViewModelItem.GetForm())
            });

            return(result);
        }