public StateVm(Model.State model) { Id = model.Id; Name = model.Name; Code = model.Code; ProductRework = new ProductReworkVm(model.OnProductRework); foreach (var ss in model.StateStations) { StateStationList.Add(new StateStationVm(ss)); } }
/// <summary> /// Creates an instance of JobListItemVm with the given model /// </summary> /// <param name="model">Product rework and Blocks in this job model are used</param> public JobListItemVm(Model.Job model) : base(model) { initializeCommands(); BlocksCount = model.Blocks.Count; //if the job has blocks, set the time range to the first and last of its blocks if (BlocksCount > 0) { StartDT = model.Blocks.OrderBy(x => x.StartDateTime).First().StartDateTime; EndDT = model.Blocks.OrderBy(x => x.StartDateTime).Last().EndDateTime; } else { StartDT = model.ReleaseTime; EndDT = model.Deadline; } ProductRework = new ProductReworkVm(model.ProductRework); }