Beispiel #1
0
        public EmpleoModuleUpdate(ICommandUpdateIdentity <Empleo> commandUpdate, IFileGetter fileGetter)
        {
            _fileGetter                = fileGetter;
            _empleoMapping             = new EmpleoMapping();
            Put["/enterprise/empleos"] = parameters =>
            {
                var request = this.Bind <EmpleoRequest>();
                if (request.isValidPut())
                {
                    /*    if (request.updateContrato)
                     *  {
                     *      var contrato = request.contrato;
                     *      if (!_fileGetter.existsFile(DirectorioArchivosContratos, contrato, Extension))
                     *      {
                     *          return new Response()
                     *                  .WithStatusCode(HttpStatusCode.BadRequest);
                     *      }
                     *      request.contentFile = fileGetter.getFile(DirectorioArchivosContratos, contrato, Extension);
                     *
                     *  }
                     *  else
                     *  {
                     *      var contrato = request.contrato;
                     *      Guid idContrato;
                     *      if (!Guid.TryParse(contrato, out idContrato)&&!string.IsNullOrEmpty(contrato))
                     *      {
                     *          return new Response()
                     *             .WithStatusCode(HttpStatusCode.BadRequest);
                     *      }
                     *
                     *  }*/
                    var empleo = _empleoMapping.getEmpleoForPut(request);

                    if (commandUpdate.isExecutable(empleo))
                    {
                        commandUpdate.execute(empleo);
                        return(new Response()
                               .WithStatusCode(HttpStatusCode.OK));
                    }
                }

                return(new Response()
                       .WithStatusCode(HttpStatusCode.BadRequest));
            };
        }
Beispiel #2
0
 public ActividadEconomicaModuleUpdate(ICommandUpdateIdentity <ActividadEconomica> command)
 {
     Put["enterprise/actividades"] = parameters =>
     {
         var request = this.Bind <ActividadEconomicaRequest>();
         if (request.isValidPut())
         {
             var actividadMap = new ActividadEconomicaMapping();
             var actividad    = actividadMap.getActividadEconomicaForPut(request);
             if (command.isExecutable(actividad))
             {
                 command.execute(actividad);
                 return(new Response()
                        .WithStatusCode(HttpStatusCode.OK));
             }
         }
         return(new Response()
                .WithStatusCode(HttpStatusCode.BadRequest));
     };
 }
 public EmpresaModuleUpdate(ICommandUpdateIdentity <Empresa> _commandUpdate, IFileGetter fileGetter)
 {
     Put["enterprise/"] = parameters =>
     {
         var request = this.Bind <EmpresaRequest>();
         if (request.isValidPost())
         {
             var empresaMap = new EmpresaMap();
             var empresa    = empresaMap.getEmpresa(request);
             if (_commandUpdate.isExecutable(empresa))
             {
                 _commandUpdate.execute(empresa);
                 return(new Response()
                        .WithStatusCode(HttpStatusCode.OK));
             }
         }
         return(new Response()
                .WithStatusCode(HttpStatusCode.BadRequest));
     };
 }
Beispiel #4
0
 public VisitaModuleUpdate(ICommandUpdateIdentity <Visita> commandUpdate)
 {
     Put["/visita"] = parameters =>
     {
         var visitaRequest = this.Bind <VisitaRequest>();
         if (visitaRequest.isValidPut())
         {
             var visitaMapping = new VisitaMapping();
             var visita        = visitaMapping.getVisitaForPut(visitaRequest);
             if (commandUpdate.isExecutable(visita))
             {
                 commandUpdate.execute(visita);
                 return(new Response()
                        .WithStatusCode(HttpStatusCode.OK));
             }
         }
         return(new Response()
                .WithStatusCode(HttpStatusCode.BadRequest));
     };
 }
        public TipoEmpleoModuleUpdate(ICommandUpdateIdentity <TipoEmpleo> command)
        {
            Put["/enterprise/tipoEmpleo"] = parameters =>
            {
                var request = this.Bind <TipoEmpleoRequest>();

                if (request.isValidPut())
                {
                    var mapTipoEmpleo = new TipoEmpleoMapping();
                    var tipoEmpleo    = mapTipoEmpleo.getTipoEmpleoForPut(request);
                    if (command.isExecutable(tipoEmpleo))
                    {
                        command.execute(tipoEmpleo);

                        return(new Response()
                               .WithStatusCode(HttpStatusCode.OK));
                    }
                }
                return(new Response()
                       .WithStatusCode(HttpStatusCode.BadRequest));
            };
        }
        public BeneficiarioModuleUpdate(ICommandUpdateIdentity <Beneficiario> commandUpdate)
        {
            Put["/enterprise/beneficiarios"] = parameters =>
            {
                var request = this.Bind <BeneficiarioRequest>();

                if (request.isValidPost())
                {
                    var beneficiarioMap = new BeneficiarioMap();
                    var beneficiario    = beneficiarioMap.getBeneficiario(request);
                    if (commandUpdate.isExecutable(beneficiario))
                    {
                        commandUpdate.execute(beneficiario);
                        return(new Response()
                               .WithStatusCode(HttpStatusCode.OK));
                    }
                }

                return(new Response()
                       .WithStatusCode(HttpStatusCode.BadRequest));
            };
        }
Beispiel #7
0
        public ParentescoModuleUpdate(ICommandUpdateIdentity <Parentesco> command)
        {
            Put["/enterprise/beneficiarios/parentescos"] = parameters =>
            {
                var request = this.Bind <ParentescoRequest>();

                if (request.isValidPut())
                {
                    var mapTipoEmpleo = new ParentescoMapping();
                    var motivoDespido = mapTipoEmpleo.getParentescoForPut(request);
                    if (command.isExecutable(motivoDespido))
                    {
                        command.execute(motivoDespido);

                        return(new Response()
                               .WithStatusCode(HttpStatusCode.OK));
                    }
                }
                return(new Response()
                       .WithStatusCode(HttpStatusCode.BadRequest));
            };
        }