コード例 #1
0
 public IHttpActionResult Put(TipoEntidad tipoEnt)
 {
     var tipoEntidad = DAO.Update(tipoEnt);
     if (tipoEntidad.IsSuccess)
     {
         return Ok(tipoEntidad.Value);
     }
     else
     {
         return ResponseMessage(Request.CreateErrorResponse(
               HttpStatusCode.Conflict,
               tipoEntidad.Error
         ));
     }
 }
コード例 #2
0
        public static void CreateTE()
        {
            var dao = new TipoEntidadDao();
            var daoTd = new TipoDocumentoDao();
            var te = new TipoEntidad();
            te.Nombre = "Rectoria";
            te.DocumentosSoportados = new TipoDocumento[] {
                daoTd.Get(26).Value,
                daoTd.Get(27 ).Value,
                daoTd.Get(28).Value,
                daoTd.Get( 29).Value,
                daoTd.Get( 30 ).Value
            };

            te = dao.Create( te ).Value;
            Console.WriteLine( te );
        }
コード例 #3
0
        public Result<TipoEntidad> Create(TipoEntidad te)
        {
            try
            {
                using (OracleConnection conn = DB.GetOracleConnection())
                using (OracleCommand cmd = DB.GetFuncionCommand(conn, "WEB_LEGEM.CREATE_TE"))
                {
                    var result = DB.AddObjectResult(cmd, UdtTypeName);
                    DB.AddObjectParameter(cmd, "tipo_entidad", UdtTypeName, te);

                    cmd.ExecuteNonQuery();
                    return Result.Ok((TipoEntidad)result.Value);
                }
            }
            catch (OracleException e)
            {
                return Result.Fail<TipoEntidad>("Registro existente con el mismo nombre");
            }
        }