public IHttpActionResult AddPlantDetails([FromBody] PlantInfoModel plant) { if (ModelState.IsValid && plant != null) { if (_info.RetrievePlantInfo().Any(plnt => plnt.PlantName.ToLower() == plant.PlantName.ToLower())) { return(BadRequest(plant.PlantName + " plant already exists.")); } var plantId = _info.AddPlantInfo(plant); if (plantId > 0) { return(Created("api/PlantConfiguration/", plantId.ToString())); } return(BadRequest("Not able to add plant details see error log for more info")); } return(BadRequest("Not able to add plants")); }