コード例 #1
0
 public ActionResult _AddAttributeList(Model.AddAttributeListModel pModel)
 {
     if (ModelState.IsValid)
     {
         AttributeTypeDTO attributesTypes = categorieProvider.getAttributeType(pModel.id_typeVA).Result;
         Regex            r = new Regex(attributesTypes.reg_expr);
         AttributeListDTO attributeListDTO = new AttributeListDTO();
         if (attributesTypes.reg_expr == "" || r.Match(pModel.valueVA).Success)
         {
             attributeListDTO.name         = pModel.attributeVA;
             attributeListDTO.value        = pModel.valueVA;
             attributeListDTO.type_id      = pModel.id_typeVA;
             attributeListDTO.user         = Request.Cookies["user_id"].Value;
             attributeListDTO.createdBy    = attributeListDTO.user;
             attributeListDTO.attribute_id = pModel.attribute_idVA;
             if (categorieProvider.postAttributeList(attributeListDTO).Result)
             {
                 return(_AttributeValuesList(pModel.attribute_idVA, pModel.attribute_nameVA));
             }
         }
         else
         {
             return(new HttpStatusCodeResult(404, "El campo valor es inválido"));
         }
     }
     return(new HttpStatusCodeResult(404, "Error, no se puede agregar el atributo"));
 }