public static BackendTournamentViewModelItem FromModel(this BackendTournamentViewModelItem viewmodel, Tournament model) { viewmodel.ID = model.ID; viewmodel.ChallongeLink = model.ChallongeLink; viewmodel.Mode = model.Mode; viewmodel.Start = model.Start; viewmodel.End = model.End; viewmodel.TeamSize = model.TeamSize; viewmodel.Event.FromModel(model.Event); viewmodel.Game.FromModel(model.TournamentGame); viewmodel.Player = model.TournamentParticipant.ToList().ConvertAll(x => { var vm = new BackendUserViewModelItem(); vm.FromModel(x); return(vm); }); viewmodel.Teams = model.TournamentTeam.Where(x => x.TournamentTeamParticipant.Count > 0).ToList().ConvertAll(x => { var vm = new BackendTournamentTeamViewModelItem(); vm.FromModel(x); return(vm); }); if (model.Partner != null) { viewmodel.Partner.FromModel(model.Partner); } viewmodel.ParticipantCount = model.TournamentParticipant.Count; viewmodel.Teams.ForEach(team => viewmodel.ParticipantCount += team.Player.Count); return(viewmodel); }
public BackendCateringViewModelItem() { Event = new BackendEventViewModelItem(); User = new BackendUserViewModelItem(); Order = new List <BackendCateringOrderItem>(); Status = new BackendCateringStatusOption(1); }
public static BackendTournamentTeamViewModelItem FromModel(this BackendTournamentTeamViewModelItem viewmodel, TournamentTeam model) { viewmodel.ID = model.ID; viewmodel.Name = model.Name; viewmodel.HasPassword = !String.IsNullOrEmpty(model.Password); viewmodel.Player = model.TournamentTeamParticipant.ToList().ConvertAll(x => { var vm = new BackendUserViewModelItem(); vm.FromModel(x); return(vm); }); return(viewmodel); }
public static BackendUserViewModelItem FromModel(this BackendUserViewModelItem viewmodel, TournamentTeamParticipant model) { viewmodel.ID = model.ID; viewmodel.FirstName = model.User.FirstName; viewmodel.LastName = model.User.LastName; viewmodel.Nickname = model.User.Nickname; viewmodel.Image = "http://lan-netconnect.de/_api/images/team/no_image.png"; // TODO viewmodel.Email = model.User.Email; viewmodel.SteamID = model.User.SteamID; viewmodel.BattleTag = model.User.BattleTag; viewmodel.Newsletter = model.User.Newsletter; viewmodel.IsAdmin = model.User.IsAdmin; viewmodel.IsTeam = model.User.IsTeam; return(viewmodel); }
public IHttpActionResult Backend_Detail_Update(Int32 id, BackendUserViewModelItem request) { BackendUserViewModel viewmodel = new BackendUserViewModel(); UserDataController dataCtrl = new UserDataController(); try { viewmodel.Data.FromModel(dataCtrl.Update(request.ToModel())); } catch (Exception ex) { return(Error(viewmodel, ex)); } return(Ok(viewmodel, "Benutzer wurde erfolgreich aktualisiert.")); }
public static User ToModel(this BackendUserViewModelItem viewmodel) { User model = new User(); model.ID = viewmodel.ID; model.FirstName = viewmodel.FirstName; model.LastName = viewmodel.LastName; model.Nickname = viewmodel.Nickname; model.Email = viewmodel.Email; model.SteamID = viewmodel.SteamID; model.BattleTag = viewmodel.BattleTag; model.Newsletter = viewmodel.Newsletter; model.IsAdmin = viewmodel.IsAdmin; model.IsTeam = viewmodel.IsTeam; return(model); }
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); }
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("Name", new InputInformation() { Type = InputInformationType.@string, Readonly = true }); result.Add("HasPassword", new InputInformation() { Type = InputInformationType.boolean, Readonly = true }); result.Add("Player", new InputInformation() { Type = InputInformationType.referenceButton, Reference = "User", ReferenceForm = BackendUserViewModelItem.GetForm() }); return(result); }
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("ReservationDate", new InputInformation() { Type = InputInformationType.datetime, Required = true }); result.Add("ReservationState", new InputInformation() { Type = InputInformationType.choice, Required = true }); result.Add("Description", new InputInformation() { Type = InputInformationType.@string }); result.Add("IsPayed", new InputInformation() { Type = InputInformationType.boolean }); result.Add("User", new InputInformation() { Type = InputInformationType.reference, Reference = "User", ReferenceForm = Form.GetReferenceForm(BackendUserViewModelItem.GetForm()), Required = true }); result.Add("TransferUser", new InputInformation() { Type = InputInformationType.reference, Reference = "TransferUser", ReferenceForm = Form.GetReferenceForm(BackendUserViewModelItem.GetForm()) }); result.Add("Event", new InputInformation() { Type = InputInformationType.reference, Reference = "Event", ReferenceForm = Form.GetReferenceForm(BackendEventViewModelItem.GetForm()), Required = true, Readonly = true }); return(result); }
public BackendSeatingViewModelItem() { User = new BackendUserViewModelItem(); Event = new BackendEventViewModelItem(); }
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("Status", new InputInformation() { Type = InputInformationType.choice, Required = true }); result.Add("SeatNumber", new InputInformation() { Type = InputInformationType.integer, Required = true, Readonly = true }); result.Add("Event", new InputInformation() { Type = InputInformationType.reference, Reference = "Event", ReferenceForm = Form.GetReferenceForm(BackendEventViewModelItem.GetForm()), Required = true, Readonly = true }); result.Add("User", new InputInformation() { Type = InputInformationType.reference, Reference = "User", ReferenceForm = Form.GetReferenceForm(BackendUserViewModelItem.GetForm()), Required = true, Readonly = true }); result.Add("Note", new InputInformation() { Type = InputInformationType.text }); result.Add("Registered", new InputInformation() { Type = InputInformationType.datetime, Readonly = true }); return(result); }