public async Task <IActionResult> PostAsync([FromBody] Rank rank) { // if Model is invalid show error message by using ModelState if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } //otherwise data save in database var result = await _rankService.SaveAsync(rank); //if result is not success show error Message if (!result.Success) { return(BadRequest(result.Message)); } return(Ok()); }