Exemple #1
0
 public IHttpActionResult AddBuilding([FromBody] Building building)
 {
     if (ModelState.IsValid && building != null)
     {
         if (_info.RetrieveAsset().Any(item => item.Name.ToLower() == building.BuildingName.ToLower() && item.Plant_ID == building.PlantId))
         {
             return(BadRequest(building.BuildingName + " building already exists"));
         }
         var assetId = _info.AddBuilding(building);
         if (assetId > 0)
         {
             return(Created("api/PlantConfiguration/Building", assetId.ToString()));
         }
         return(BadRequest("Not able to add  department details see log file for more reference"));
     }
     return(BadRequest("Enter plant details properly"));
 }