public async Task <IActionResult> PutAdminSquare(string id, AdminSquare adminSquare) { if (id != adminSquare.AdminId) { return(BadRequest()); } _context.Entry(adminSquare).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdminSquareExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <AdminSquare> > PostAdminSquare(AdminSquare adminSquare) { _context.AdminSquares.Add(adminSquare); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (AdminSquareExists(adminSquare.AdminId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetAdminSquare", new { id = adminSquare.AdminId }, adminSquare)); }