public IActionResult CreateBatch([FromBody] BatchFile batch) { try { if (batch.BusinessUnit == null || batch.BusinessUnit == "") { logger.LogInfo("business unit is empty"); return(BadRequest(modelValidation.ValidateModel("400", "business unit is empty", "business unit should not be empty"))); } if (batch.BusinessUnit != null || batch.BusinessUnit != "") { if (configuration["businessUnit"].ToString() != batch.BusinessUnit.ToString()) { logger.LogInfo("business unit is not correct"); return(BadRequest(modelValidation.ValidateModel("400", "business unit incorrect", "incorrect business unit is provided"))); } } foreach (var attribute in batch.Attributes) { if (attribute.Key == null || attribute.Key == "") { logger.LogInfo("key is empty"); return(BadRequest(modelValidation.ValidateModel("400", "key is empty", "key should not be empty"))); } if (attribute.Value == null || attribute.Value == "") { logger.LogInfo("value is empty"); return(BadRequest(modelValidation.ValidateModel("400", "value is empty", "value should not be empty"))); } } BatchFile newBatchObj = batchService.AddBatch(batch); if (newBatchObj != null) { var containerData = commonUtility.CreateContainer(configuration["storageAccountName"].ToString(), configuration["storageKey"].ToString(), newBatchObj.BatchId.ToString()); } var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }; BatchFile batchFileGuid = new BatchFile { BatchId = newBatchObj.BatchId }; string responseBatchFile = JsonConvert.SerializeObject(batchFileGuid, Formatting.Indented, settings); return(Ok(responseBatchFile)); } catch (Exception ex) { logger.LogError(ex.Message.ToString()); return(BadRequest(ex.Message.ToString())); } }