Exemplo n.º 1
0
 public BackendTournamentViewModelItem()
 {
     Event  = new BackendEventViewModelItem();
     Game   = new BackendGameViewModelItem();
     Player = new List <BackendUserViewModelItem>();
     Teams  = new List <BackendTournamentTeamViewModelItem>();
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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."));
        }
Exemplo n.º 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);
        }