Пример #1
0
 public ActionResult _EditGeneralAttributeList(Model.EditAttributeListModel pModel)
 {
     if (ModelState.IsValid)
     {
         AttributeTypeDTO attributesType = categorieProvider.getAttributeType(pModel.id_type).Result;
         Regex            r = new Regex(attributesType.reg_expr);
         AttributeListDTO attributeListDTO = new AttributeListDTO();
         if (attributesType.reg_expr == "" || r.Match(pModel.value).Success)
         {
             attributeListDTO.name              = pModel.attribute;
             attributeListDTO.value             = pModel.value;
             attributeListDTO.type_id           = pModel.id_type;
             attributeListDTO.isEnabled         = pModel.isEnabled == "on" ? "true" : "false";
             attributeListDTO.user              = Request.Cookies["user_id"].Value;
             attributeListDTO.id_attributeValue = pModel.id_attributeValue;
             if (categorieProvider.putAttributeList(attributeListDTO).Result)
             {
                 return(new HttpStatusCodeResult(200));
             }
         }
         else
         {
             return(new HttpStatusCodeResult(404, "El campo valor es inválido"));
         }
     }
     else
     {
         return(new HttpStatusCodeResult(404, "Error, debe completar todos los campos"));
     }
     return(new HttpStatusCodeResult(404, "Error, no se puede agregar el atributo"));
 }