public StackListItemViewModel ToListItemViewModel() { var vm = new StackListItemViewModel() { Id = GuidMappings.Map(this.Id), Title = this.Title, IsDeleted = this.IsDeleted }; return(vm); }
public RecordViewModel ToViewModel() { var vm = new RecordViewModel() { Id = GuidMappings.Map(this.Id), Title = this.Title, ImageUrl = this.ImageUrl, SourceUrl = this.SourceUrl, IsDeleted = this.IsDeleted }; return(vm); }
private async Task <LoginResponseViewModel> ProviderLogin(LoginViewModel vm) { LoginResponseViewModel resp = new LoginResponseViewModel(); ICollection <Stack> stacks = new List <Stack>(); stacks = _repository.GetStacks(); ICollection <StackListItemViewModel> vms = new List <StackListItemViewModel>(stacks.Count); foreach (var stack in stacks) { vms.Add(stack.ToListItemViewModel()); } resp.SessionInfo = new SessionInfoViewModel(); resp.SessionInfo.IdToken = GuidMappings.Map(Guid.NewGuid()); resp.SessionInfo.Username = vm.Username; resp.Stacks = vms; return(resp); }
public StackViewModel ToViewModel() { var vm = new StackViewModel() { Id = GuidMappings.Map(this.Id), Title = this.Title, Records = this.Records != null ? new List <RecordViewModel>(this.Records.Count) : new List <RecordViewModel>(), IsDeleted = this.IsDeleted }; if (this.Records != null) { foreach (var record in this.Records) { vm.Records.Add(record.ToViewModel()); } } return(vm); }