Exemple #1
0
        public async Task <ActionResult <Governs> > PostGoverns(Governs governs)
        {
            _context.Governs.Add(governs);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetGoverns), new { id = governs.GovernsID }, governs));
        }
Exemple #2
0
        public async Task <IActionResult> PutGoverns(int id, Governs governs)
        {
            if (id != governs.GovernsID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }