Exemplo n.º 1
0
        public async Task <ActionResult <Sofmaster> > PostSofmaster(Sofmaster sofmaster)
        {
            _context.Sofmasters.Add(sofmaster);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSofmaster", new { id = sofmaster.SofmasterId }, sofmaster));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutSofmaster(int id, Sofmaster sofmaster)
        {
            if (id != sofmaster.SofmasterId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }