public JsonResult GetControlTypeList()
 {
     try
     {
         RequestPackage request = new RequestPackage();
         ResponseObjectPackage<List<ControlTypeListEntity>> response = new FormEditorLogic().GetControlTypeList(request).GetSelfOrExceptionIfError();
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 public JsonResult GetFormByID(int id)
 {
     try
     {
         RequestPackage request = new RequestPackage()
         {
             requestID = id
         };
         ResponseObjectPackage<OpenFormModel> response = new FormEditorLogic().GetFormByID(request).GetSelfOrExceptionIfError();
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 public JsonResult SaveFormInTransaction(SaveFormModel formModel)
 {
     try
     {
         RequestObjectPackage<SaveFormModel> request = new RequestObjectPackage<SaveFormModel>()
         {
             requestData = formModel
         };
         ResponsePackage response = new FormEditorLogic().SaveFormInTransaction(request).GetSelfOrExceptionIfError();
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 public JsonResult SaveProperty(ControlPropertyViewModel property)
 {
     try
     {
         RequestObjectPackage<ControlPropertyViewModel> request = new RequestObjectPackage<ControlPropertyViewModel>()
         {
             requestData = property
         };
         ResponsePackage response = new FormEditorLogic().SaveProperty(request).GetSelfOrExceptionIfError();
         return Json(response);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }
 public JsonResult SaveAllForm(SaveControlModel form, int formID)
 {
     try
     {
         RequestObjectPackage<SaveControlModel> request = new RequestObjectPackage<SaveControlModel>()
         {
             requestData = form,
             requestID = formID
         };
         // удалить старые контролы
         ResponsePackage responseDelete = new FormEditorLogic().DeleteOldControls(request).GetSelfOrExceptionIfError();
         // сохранить запросы
         RequestObjectPackage<List<QueryViewModel>> req = new RequestObjectPackage<List<QueryViewModel>>() { requestData = form.queries };
         ResponsePackage responseQuery = new FormEditorLogic().SaveQueries(req).GetSelfOrExceptionIfError();
         // сохранить всю форму
         ResponsePackage response = new FormEditorLogic().SaveAllForm(request).GetSelfOrExceptionIfError();
         // задать controlID евентам
         ResponsePackage responseSetControlID = new FormEditorLogic().SetEventControlID(request).GetSelfOrExceptionIfError();
         // сохранить евенты
         ResponsePackage responseEvents = new FormEditorLogic().SaveAllEvents(request).GetSelfOrExceptionIfError();
         return Json(responseEvents);
     }
     catch (Exception ex)
     {
         return this.HandleException(ex);
     }
 }