Пример #1
0
        public async Task <ActionResult <Dimmaster> > PostDimmaster(Dimmaster dimmaster)
        {
            _context.Dimmaster.Add(dimmaster);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDimmaster", new { id = dimmaster.DimId }, dimmaster));
        }
Пример #2
0
        public async Task <IActionResult> PutDimmaster(int id, Dimmaster dimmaster)
        {
            if (id != dimmaster.DimId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }