Description:
Develop an endpoint to save a language. The endpoint will process the Language payload, validate it, and save it into the database. It should return a response indicating the success or failure of the operation.
Acceptance Criteria:
Implement a POST action in the controller that accepts a Language object in the request body.
Validate the input language using the validation logic.
Save the language.
Business Logic:
Check if the language already exists.
If the language exists, update it. Otherwise, create a new one.
Error Handling:
If validation fails, return a response with the validation errors.
Log errors during the save operation and return a response with the error message.
Response Handling:
On successful save: Return a response with no errors.
On failure: Return a response containing the error message.
Description:
Develop an endpoint to save a language. The endpoint will process the Language payload, validate it, and save it into the database. It should return a response indicating the success or failure of the operation.
Acceptance Criteria:
Implement a POST action in the controller that accepts a Language object in the request body.
Validate the input language using the validation logic.
Save the language.
Business Logic:
Check if the language already exists.
If the language exists, update it. Otherwise, create a new one.
Error Handling:
If validation fails, return a response with the validation errors.
Log errors during the save operation and return a response with the error message.
Response Handling:
On successful save: Return a response with no errors.
On failure: Return a response containing the error message.