Пример #1
0
        public async Task <IActionResult> PutDAYMAY([FromRoute] string id, [FromBody] DAYMAY dAYMAY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dAYMAY.MADM)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PostDAYMAY([FromBody] DAYMAY dAYMAY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.DAYMAY.Add(dAYMAY);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDAYMAY", new { id = dAYMAY.MADM }, dAYMAY));
        }