public ActionResult Post(bool IsNew, Spartan_Traduction_Process_DataModel varSpartan_Traduction_Process_Data) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Traduction_Process_DataApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Spartan_Traduction_Process_DataInfo = new Spartan_Traduction_Process_Data { Clave = varSpartan_Traduction_Process_Data.Clave , Concept = varSpartan_Traduction_Process_Data.Concept , Name_of_Control = varSpartan_Traduction_Process_Data.Name_of_Control , Original_Text = varSpartan_Traduction_Process_Data.Original_Text , Translated_Text = varSpartan_Traduction_Process_Data.Translated_Text }; result = !IsNew? _ISpartan_Traduction_Process_DataApiConsumer.Update(Spartan_Traduction_Process_DataInfo, null, null).Resource.ToString() : _ISpartan_Traduction_Process_DataApiConsumer.Insert(Spartan_Traduction_Process_DataInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 35162); ViewBag.Permission = permission; var varSpartan_Traduction_Process_Data = new Spartan_Traduction_Process_DataModel(); ViewBag.ObjectId = "35162"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Traduction_Process_DataApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Traduction_Process_DataData = _ISpartan_Traduction_Process_DataApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Traduction_Process_Datas[0]; if (Spartan_Traduction_Process_DataData == null) { return(HttpNotFound()); } varSpartan_Traduction_Process_Data = new Spartan_Traduction_Process_DataModel { Clave = (int)Spartan_Traduction_Process_DataData.Clave , Concept = Spartan_Traduction_Process_DataData.Concept , ConceptConcept_Description = (string)Spartan_Traduction_Process_DataData.Concept_Spartan_Traduction_Concept_Type.Concept_Description , Name_of_Control = Spartan_Traduction_Process_DataData.Name_of_Control , Original_Text = Spartan_Traduction_Process_DataData.Original_Text , Translated_Text = Spartan_Traduction_Process_DataData.Translated_Text }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Traduction_Concept_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Traduction_Concept_Types_Concept = _ISpartan_Traduction_Concept_TypeApiConsumer.SelAll(true); if (Spartan_Traduction_Concept_Types_Concept != null && Spartan_Traduction_Concept_Types_Concept.Resource != null) { ViewBag.Spartan_Traduction_Concept_Types_Concept = Spartan_Traduction_Concept_Types_Concept.Resource.OrderBy(m => m.Concept_Description).Select(m => new SelectListItem { Text = m.Concept_Description.ToString(), Value = Convert.ToString(m.IdConcept) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_Traduction_Process_Data)); }