Ejemplo n.º 1
0
        public async Task CreateCommet(CommetCreateDto commetCreateDto)
        {
            Blog blog = _context.Blogs.Find(commetCreateDto.BlogId);

            Commet newCommet = _mapper.Map <Commet>(commetCreateDto);
            await _context.Commets.AddAsync(newCommet);

            await _context.SaveChangesAsync();
        }
        public async Task <ActionResult> Create([FromBody] CommetCreateDto commetCreateDto)
        {
            try
            {
                await _commetRepository.CreateCommet(commetCreateDto);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }