Ejemplo n.º 1
0
        public async Task <IActionResult> PutCharacter(int id, Character character)
        {
            if (id != character.CharacterId)
            {
                return(BadRequest());
            }

            _context.Entry(character).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CharacterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <OwnedItem> > PostOwnedItem(OwnedItem item)
        {
            _context.OwnedItem.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOwnedItem", new { id = item.OwnedItemId }, item));

            return(BadRequest("testing post: " + item.ItemId));

            //var itemQuery =
            //    from

            //return null;
            //_context.Character.Add(character);
            //await _context.SaveChangesAsync();

            //return CreatedAtAction("GetCharacter", new { id = character.CharacterId }, character);
        }