public IHttpActionResult AddFormData([FromBody] EquipmentModels.Edit Equipment) { string logForm = "Form : " + Startup._jsSerializer.Serialize(Equipment); string logAPI = "[Post] " + Request.RequestUri.ToString(); if (!ModelState.IsValid || Equipment == null) { Startup._sfAppLogger.Warn(logAPI + " || Input Parameter not expected || " + logForm); return(BadRequest("Invalid data")); } try { EquipmentModels equipmentModel = new EquipmentModels(); int newEquipmentId = equipmentModel.addEquipment(Equipment); return(Json(new { id = newEquipmentId })); } catch (Exception ex) { StringBuilder logMessage = LogUtility.BuildExceptionMessage(ex); logMessage.AppendLine(logForm); Startup._sfAppLogger.Error(logAPI + logMessage); return(InternalServerError(ex)); } }