コード例 #1
0
        public async Task <ActionResult> Añadir(FavoritoDtoCreate model)
        {
            var result = await _PadreService.Añadir(model);

            return(CreatedAtAction(
                       "GetById",
                       new { id = result.FavoritoId },
                       result));
        }
コード例 #2
0
        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));
        }