public async Task <ActionResult> Añadir(FavoritoDtoCreate model) { var result = await _PadreService.Añadir(model); return(CreatedAtAction( "GetById", new { id = result.FavoritoId }, result)); }
public async Task <FavoritoDto> Añadir(FavoritoDtoCreate model) { var entry = new Favorito { PadreId = model.PadreId, DocenteId = model.DocenteId }; await _context.AddAsync(entry); await _context.SaveChangesAsync(); return(_mapper.Map <FavoritoDto>(entry)); }