public async Task <IActionResult> PutParte2([FromRoute] int id, [FromBody] Parte2 parte2)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != parte2.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PostParte2([FromBody] Parte2 parte2)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Parte2.Add(parte2);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetParte2", new { id = parte2.Id }, parte2));
        }
示例#3
0
 private void Awake()
 {
     instance = this;        // ??????
 }