Ejemplo n.º 1
0
        public ActionResult <TagsDTO> GetTags()
        {
            TagsDTO result = new TagsDTO();

            result.Tags = _context.Tags.Select(x => x.Name).ToList();
            return(result);
        }
Ejemplo n.º 2
0
        public async Task OnGetAsync()
        {
            var posts = await service1Client.getTagsAsync();

            posts.Sort();
            foreach (var item in posts)
            {
                TagsDTO tag = new TagsDTO();
                tag.name = item;
                Tags.Add(tag);
            }
        }
Ejemplo n.º 3
0
        public TagsDTO GetAll()
        {
            var tagGetAll = _unitOfWork.Tag.GetAll();

            TagsDTO tagList = new TagsDTO()
            {
                tags = new List <string>()
            };

            tagList.tags = tagGetAll.Select(x => x.TagId).ToList();

            return(tagList);
        }
Ejemplo n.º 4
0
        ////////////////Tags

        public TagsDTO GetTagByPostTagId(int id)
        {
            using (var db = new SovaContext())
            {
                var     tag     = db.Tags.Where(t => t.Id == id).FirstOrDefault();
                TagsDTO tagsDTO = null;
                if (tag != null)
                {
                    tagsDTO = new TagsDTO(tag.Id, tag.Tag);
                }
                return(tagsDTO);
            }
        }
Ejemplo n.º 5
0
        public ICollection <TagsDTO> GetTags()
        {
            using (var db = new SovaContext())
            {
                var            tags    = db.Tags.ToList();
                List <TagsDTO> tagsDTO = new List <TagsDTO>();

                foreach (var t in tags)
                {
                    var newtag = new TagsDTO(t.Id, t.Tag);
                    tagsDTO.Add(newtag);
                }
                return(tagsDTO);
            }
        }
Ejemplo n.º 6
0
        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());
        }