State & City Management

States

IdState NameRemove

Add State


Cities

IdCity NameState NameIs CapitalInfoRemove

Add City


Find City Details


Business requirement — Database Operation 5

Create City and prevent two cities from being marked as capital for the same state.

  1. Create City with Id, StateId, Name, and IsCapital.
  2. Build a City form with State, Name, and Is Capital inputs.
  3. Before saving a capital, query for another capital in the selected state.
  4. Stop the save and show a clear message if one already exists.
  5. Show a spinner until a valid save finishes.