public ActorDetailsViewModel(ErrandActor errandActor) { Id = errandActor.Id; if (errandActor.Image != null) { Image = Convert.ToBase64String(errandActor.Image); } Name = errandActor.Name; Active = errandActor.IsActive; CreatedDate = errandActor.CreatedDate.ToShortDateString(); ModifiedDate = errandActor.ModifiedDate.ToShortDateString(); KilledById = errandActor.KilledById; CompletedErrands = errandActor.Errands.Where(e => e.Status == ErrandStatus.Completed).Select(e => new ErrandViewModel(e)).ToArray(); FailedErrands = errandActor.Errands.Where(e => e.Status == ErrandStatus.Failed).Select(e => new ErrandViewModel(e)).ToArray(); Type = Enum.GetName(typeof(ActorType), errandActor.ActorType); }
public ErrandActorViewModel(ErrandActor actor) { Id = actor.Id; Name = actor.Name; ActorType = actor.ActorType; }