Example #1
0
        public async Task Descurtir(int id)
        {
            var projeto = await Projetos.GetByIdAssync(id);

            projeto.Unlikes++;
            await _context.SaveChangesAsync();
        }
Example #2
0
        //public void Update(Projetos proj) => Projetos.Update(proj);

        //public void Create(Projetos proj) => Projetos.Insert(proj);

        //public async void Delete(int id) => await Projetos.DeleteAsync(id);

        public async Task Curtir(int id)
        {
            var projeto = await Projetos.GetByIdAssync(id);

            projeto.Likes++;
            _context.Update(projeto);
            await _context.SaveChangesAsync();
        }
Example #3
0
        //public async Task<List<Projetos>> GetAll() => (List<Projetos>) await Projetos.GetAsync();

        public async Task <Projetos> GetById(int id)
        {
            var projeto = await Projetos.GetByIdAssync(id);

            if (projeto == null)
            {
                return(null);
            }
            var imgs = await Img.GetAsync(x => x.ProjetosId == projeto.Id);

            var respostas = await Resp.GetAsync(x => x.ProjetosId == projeto.Id);

            var tagProj = await TagProj.GetAsync(x => x.ProjetosId == projeto.Id);

            var lisTags = new List <Tags>();

            projeto.Respostas = respostas;
            projeto.Imagens   = imgs;
            projeto.Tag       = tagProj;
            return(projeto);
        }