public int CreateInputAdvisorInputs(InputAdvisor inputAdvisor)
 {
     try
     {
         int inputAdvisorID = 0;
         var parameters     = InputAdvisorParameters.GetCreateInputAdvisorInputParameters(projectDBManager, inputAdvisor);
         inputAdvisorID = projectDBManager.Insert("CALL project.create_input_advisor_inputs(@project_id,@resource_id,@created_by,@input_advisor_object,@input_advisor_id)",
                                                  CommandType.Text, parameters.ToArray(), out inputAdvisorID);
         return(inputAdvisorID);
     }
     catch (Exception createInputAdvisorInputsException)
     {
         throw new Exception(ExceptionMessages.CREATE_INPUT_ADVISOR_INPUTS_DATA_ACCESS_ERROR_MSG, createInputAdvisorInputsException);
     }
 }
Example #2
0
 public ActionResult CreateInputAdvisorInputs(InputAdvisor inputAdvisorInput, string pageID)
 {
     if (projectService.IsProjectIDExistsForResourceID(inputAdvisorInput.ProjectID, inputAdvisorInput.ResourceID))
     {
         string jsonObj = Convert.ToString(inputAdvisorInput.Object);
         if (!string.IsNullOrEmpty(jsonObj) && jsonObj.StartsWith("{") && jsonObj.EndsWith("}"))
         {
             projectService.ValidateInputAdvisorJson(pageID, inputAdvisorInput.Object);
         }
         InputAdvisor createdInputAdvisorInputs = projectService.CreateInputAdvisorInputs(inputAdvisorInput);
         return(Created(ResponseMessages.INPUT_ADVISOR_INPUTS_CREATED, createdInputAdvisorInputs));
     }
     else
     {
         return(NotFound(string.Format(ValidationErrors.PROJECT_ID_DOES_NOT_EXISTS_RESOURCE_ID_VAL_MSG, inputAdvisorInput.ProjectID, inputAdvisorInput.ResourceID)));
     }
 }
Example #3
0
        public static List <IDbDataParameter> GetCreateInputAdvisorInputParameters(IProjectDBManager projectDBManager, InputAdvisor inputAdvisor)
        {
            List <IDbDataParameter> saveInputAdvisorInputParameters = new List <IDbDataParameter>();

            saveInputAdvisorInputParameters.Add(projectDBManager.CreateParameter("@project_id", inputAdvisor.ProjectID, DbType.Int32));
            saveInputAdvisorInputParameters.Add(projectDBManager.CreateParameter("@resource_id", inputAdvisor.ResourceID, DbType.Int32));
            saveInputAdvisorInputParameters.Add(projectDBManager.CreateParameter("@created_by", inputAdvisor.CreatedBy, DbType.String));
            saveInputAdvisorInputParameters.Add(projectDBManager.CreateParameter("@input_advisor_object", inputAdvisor.Object.ToString(), DbType.String));
            saveInputAdvisorInputParameters.Add(projectDBManager.CreateParameter("@input_advisor_id", 1, DbType.Int32));
            return(saveInputAdvisorInputParameters);
        }