예제 #1
0
        public async Task <ActionResult> Put(int id, [FromBody] EmailProveedorCreacionDTO emailProveedprActualizacion)
        {
            var emailProveedor = _mapper.Map <EmailProveedor>(emailProveedprActualizacion);

            emailProveedor.CodigoEmail            = id;
            _contexto.Entry(emailProveedor).State = EntityState.Modified;
            await _contexto.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <ActionResult> Put(int id, [FromBody] EmailProveedorCreacionDTO emailProveedorCreacionDTO)
        {
            var emailProveedor = this.mapper.Map <EmailProveedor>(emailProveedorCreacionDTO);

            emailProveedor.CodigoEmail = id;
            this.inventarioDBContext.Entry(emailProveedor).State = EntityState.Modified;
            await this.inventarioDBContext.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <ActionResult> Post([FromBody] EmailProveedorCreacionDTO emailProveedorCreacion)
        {
            var emailProveedor = mapper.Map <EmailProveedor>(emailProveedorCreacion);

            contexto.Add(emailProveedor);
            await contexto.SaveChangesAsync();

            var emailProveedorDTO = mapper.Map <EmailProveedorDTO>(emailProveedor);

            return(new CreatedAtRouteResult("GetEmailProveedor", new { id = emailProveedor.codigoEmail }, emailProveedorDTO));
        }
예제 #4
0
        public async Task <ActionResult> Post([FromBody] EmailProveedorCreacionDTO emailProveedorCreacion)//Se espera recibir un JSON o un DOC.XML
        {
            var emailProveedor = this.mapper.Map <EmailProveedor>(emailProveedorCreacion);

            this.dBContext.Add(emailProveedor);
            await this.dBContext.SaveChangesAsync();

            var emailProveedorDTO = this.mapper.Map <EmailProveedorDTO>(emailProveedor);

            return(new CreatedAtRouteResult("GetEmailProveedor", new { id = emailProveedor.CodigoEmail }, emailProveedorDTO));
        }
        public async Task <ActionResult> Post([FromBody] EmailProveedorCreacionDTO emailProveedorCreacionDTO)
        {
            var emailProveedor = this.mapper.Map <EmailProveedor>(emailProveedorCreacionDTO);

            this.inventarioDBContext.Add(emailProveedor);
            await this.inventarioDBContext.SaveChangesAsync();

            var emailProveedorDTO = this.mapper.Map <EmailProveedorDTO>(emailProveedor);

            return(new CreatedAtRouteResult("GetEmailProveedor", new { id = emailProveedor.CodigoEmail },
                                            emailProveedorDTO));
        }