public IActionResult AddClassProperty([FromRoute] string languageId, [FromRoute] string classname, [FromBody] KProperty kProperty) { try { var userId = string.Empty; userId = AuthHelper.AuthorizeRequest(Request); var tempCommand = new AddPropertyRequestModel() { Property = kProperty, ClassName = classname, UserId = userId, LanguageId = languageId }; List <System.ComponentModel.DataAnnotations.ValidationResult> validationResult = new List <System.ComponentModel.DataAnnotations.ValidationResult>(); if (kProperty == null) { validationResult.Add(new System.ComponentModel.DataAnnotations.ValidationResult("Property can not be null")); } else if (string.IsNullOrEmpty(kProperty.Name)) { validationResult.Add(new System.ComponentModel.DataAnnotations.ValidationResult("Property name can not be null")); } if (validationResult.Any()) { return(BadRequest(validationResult)); } return(Ok(MongoConnector.AddPropertyToClass(tempCommand))); } catch (Exception ex) { return(BadRequest(ex)); } }