Exemplo n.º 1
0
        public async Task <PublicationDTO> Insert(PublicationDTO dto)
        {
            Counter counter = await _counterDAO.GetCountersAsync();

            int id = counter.Publications++;
            await _counterDAO.UpdateCountersAsync(counter);

            Publication publication = Publication.FromDTO(dto);

            publication.Id = id;

            await _context.Publications.InsertOneAsync(publication);

            return(FindById(publication.Id).Result);
        }