コード例 #1
0
 public ActionResult _AddPersonalAttribute(Model.AddPersonalAttributeModel pModel)
 {
     if (ModelState.IsValid)
     {
         AttributeTypeDTO     attributesTypes = categorieProvider.getAttributeType(pModel.id_typePA).Result;
         Regex                r = new Regex(attributesTypes.reg_expr);
         PersonalAttributeDTO personaAttributeDTO = new PersonalAttributeDTO();
         if (attributesTypes.reg_expr == "" || r.Match(pModel.valuePA).Success)
         {
             personaAttributeDTO.name         = pModel.attributePA;
             personaAttributeDTO.value        = pModel.valuePA;
             personaAttributeDTO.type_id      = pModel.id_typePA;
             personaAttributeDTO.userLog      = Request.Cookies["user_id"].Value;
             personaAttributeDTO.createdBy    = personaAttributeDTO.userLog;
             personaAttributeDTO.categorie_id = pModel.categorie_idPA;
             if (categorieProvider.postPersonalAttribute(personaAttributeDTO).Result)
             {
                 return(_PersonalAttrList(pModel.categorie_idPA));
             }
         }
         else
         {
             return(new HttpStatusCodeResult(404, "El campo valor es inválido"));
         }
     }
     return(new HttpStatusCodeResult(404, "Error, no se puede agregar el atributo"));
 }