public InformationsDTO GetAllInformationByUser(string email) { var result = context.Informations.Where(i => i.ApplicationUser.Email == email).ToList(); InformationsDTO billsDTO = new InformationsDTO(); billsDTO.InformationList = new List <InformationDTO>(); foreach (var bill in result) { billsDTO.InformationList.Add(mapper.Map <InformationDTO>(bill)); } return(billsDTO); }
public InformationsDTO GetAllByUser(string mail) { var result = _context.Information.Where(m => m.User.Email == mail).ToList(); InformationsDTO informationDTO = new InformationsDTO() { }; informationDTO.informationList = new List <InformationDTO>(); foreach (Information information in result) { informationDTO.informationList.Add(_mapper.Map <InformationDTO>(information)); } return(informationDTO); }
public async Task <IActionResult> OnGetAsync(string name) { /*var configInfo = new MapperConfiguration(cfg => { * cfg.CreateMap<Informations, InformationsDTO>(); * }); * IMapper mapperInfo = configInfo.CreateMapper();*/ if (name == null) { return(NotFound()); } List <ServiceReference2.Informations> infos = await service1Client.GetPicturesByTagMetodAsync(null, name); foreach (ServiceReference2.Informations info in infos) { TagsDTO tagInfo = new TagsDTO(); tagInfo.Id = info.tag_id.Id; tagInfo.name = info.tag_id.name; //mapperTag.Map<WindowsFormsApp1.Tags, Tags>(info.tag_id); PictureDTO pictureInfo = new PictureDTO(); pictureInfo.created_at = info.picture_id.created_at; pictureInfo.deleted = info.picture_id.deleted; pictureInfo.full_name = info.picture_id.full_name; pictureInfo.Id = info.picture_id.Id; pictureInfo.path = info.picture_id.path.Replace("\\", "/"); //mapperTag.Map<WindowsFormsApp1.Picture, Picture>(info.picture_id); InformationsDTO informations = new InformationsDTO(); informations.description = info.description; informations.Id = info.Id; informations.picture_id = pictureInfo; informations.tag_id = tagInfo; //mapperInfo.Map<Informations, InformationsDTO>(info); Informations.Add(informations); } if (Informations == null) { return(NotFound()); } return(Page()); }
public InformationsDTO GetAllInformationsByUser(string email) { _logger.LogInformation("Executing GetInformationsByUser method"); List <Information> informations = _context.Information.Where(i => i.User.Email == email).ToList(); InformationsDTO informationDTO = new InformationsDTO() { }; informationDTO.InformationsList = new List <InformationDTO>(); foreach (Information information in informations) { informationDTO.InformationsList.Add(_mapper.Map <InformationDTO>(information)); } return(informationDTO); }