예제 #1
0
        public AddMissionViewModel(MissionDTO mission)
        {
            IsEdit         = true;
            ButtonLabel    = "Edit";
            MissionTypes   = MissionTypeService.GetAllBindableCollection();
            AvailableTeams = new BindableCollection <TeamDTO>(TeamService.GetAll().Where(x => x.MissionId == null).ToList());
            ActualTeams    = new BindableCollection <TeamDTO>(TeamService.GetAll().Where(x => x.MissionId == mission.Id).ToList());

            int i = 0;

            while (ActualType == null)
            {
                if (MissionTypes[i].Id == mission.MissionTypeId)
                {
                    ActualType = i;
                    break;
                }
                else
                {
                    i++;
                }
            }

            this.toEdit = mission;
            Name        = mission.Name;
            Description = mission.Description;
            StartTime   = mission.StartTime;
            EndTime     = mission.EndTime;
            NotifyOfPropertyChange(() => Name);
            NotifyOfPropertyChange(() => Description);
            NotifyOfPropertyChange(() => StartTime);
            NotifyOfPropertyChange(() => EndTime);
        }
예제 #2
0
 public AddMissionViewModel()
 {
     IsEdit         = false;
     ButtonLabel    = "Add";
     MissionTypes   = MissionTypeService.GetAllBindableCollection();
     AvailableTeams = new BindableCollection <TeamDTO>(TeamService.GetAll().Where(x => x.MissionId == null).ToList());
     ActualTeams    = new BindableCollection <TeamDTO>();
     StartTime      = DateTime.Now;
     newMission     = new MissionDTO();
     NotifyOfPropertyChange(() => StartTime);
 }