I have an POST method to create an entity. In this table email is primary key and other columns are user information (name,surname, etc.)
I have two questions, please answer both :)
1) If customer send an email that already exist in database, API returns 500. But I want to return 400 and say "this email already in use". How can I do that when I trying to add new user to database.?
2) Is it true approach to make email as primary key for database design?
Im using ef core3.1 and asp.net core 3.1
↧
Validating the entity already exist
↧