public ActionResult _EditGeneralAttribute(Model.EditGeneralAttributeModel pModel) { if (ModelState.IsValid || (pModel.id_type == "4" && pModel.attribute != null)) { AttributeTypeDTO attributesType = categorieProvider.getAttributeType(pModel.id_type).Result; Regex r = new Regex(attributesType.reg_expr); GeneralAttributeDTO generalAttributeDTO = new GeneralAttributeDTO(); if (attributesType.reg_expr == "" || r.Match(pModel.value).Success) { generalAttributeDTO.name = pModel.attribute; generalAttributeDTO.value = pModel.value; generalAttributeDTO.type_id = pModel.id_type; generalAttributeDTO.isEnabled = pModel.isEnabled == "on" ? "true" : "false"; generalAttributeDTO.user = Request.Cookies["user_id"].Value; generalAttributeDTO.id_attribute = pModel.id_attribute; if (categorieProvider.putGeneralAttribute(generalAttributeDTO).Result) { return(new HttpStatusCodeResult(200)); } } else { return(new HttpStatusCodeResult(404, "El campo valor es inválido")); } } else { foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { string sError = error.ErrorMessage; } } return(new HttpStatusCodeResult(404, "Error, debe completar todos los campos")); } return(new HttpStatusCodeResult(404, "Error, no se puede agregar el atributo")); }