public NegocioDto ObtenerPorId(long id) { using (var context = new KosakoDBEntities()) { var negocio = context.Negocios.FirstOrDefault(x => x.Id == id); if (negocio != null) { var NEGOCIO = new NegocioDto { Celular = negocio.Celular, Cuit = negocio.Cuit, Direccion = negocio.Direccion, Email = negocio.Email, Id = negocio.Id, Imagen = negocio.Imagen, RazonSocial = negocio.RazonSocial }; return(NEGOCIO); } return(null); } }
public override bool EjecutarComandoModificar() { if (!VerificarDatosObligatorios()) { MessageBox.Show(@"Por favor ingrese los campos Obligatorios.", @"Atención", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } var Modificar = new NegocioDto { Id = EntidadId.Value, RazonSocial = txtRazonSocial.Text, Cuit = txtCuit.Text, Celular = txtCelular.Text, Direccion = txtDireccion.Text, Email = txtEmail.Text, Imagen = ImagenDb.Convertir_Imagen_Bytes(imgFotoEmpleado.Image), }; negocioServicio.Modificar(Modificar); NegocioLogeado.Id = Modificar.Id; NegocioLogeado.RazonSocial = Modificar.RazonSocial; NegocioLogeado.Email = Modificar.Email; NegocioLogeado.Cuit = Modificar.Cuit; NegocioLogeado.Direccion = Modificar.Direccion; NegocioLogeado.Celular = Modificar.Celular; NegocioLogeado.Imagen = Modificar.Imagen; return(true); }
public async Task <IActionResult> Delete(NegocioDto dto) { var result = new HttpResult <NegocioDto>(this._logger, this._service); try { await this._service.Remove(dto); return(result.ReturnCustomResponse(dto)); } catch (Exception ex) { return(result.ReturnCustomException(ex, "Negocio", dto)); } }
public void Modificar(NegocioDto negocioDto) { using (var context = new KosakoDBEntities()) { var negocio = context.Negocios.FirstOrDefault(x => x.Id == negocioDto.Id); negocio.RazonSocial = negocioDto.RazonSocial; negocio.Cuit = negocioDto.Cuit; negocio.Celular = negocioDto.Celular; negocio.Direccion = negocioDto.Direccion; negocio.Email = negocioDto.Email; negocio.Imagen = negocioDto.Imagen; context.SaveChanges(); } }
public void Insertar(NegocioDto negocioDto) { using (var context = new KosakoDBEntities()) { var negocio = new AccesoDatos.Negocio { Celular = negocioDto.Celular, Direccion = negocioDto.Direccion, Cuit = negocioDto.Cuit, Email = negocioDto.Email, RazonSocial = negocioDto.RazonSocial, Imagen = negocioDto.Imagen }; context.Negocios.Add(negocio); context.SaveChanges(); } }
public override bool EjecutarComandoNuevo() { if (!VerificarDatosObligatorios()) { MessageBox.Show(@"Por favor ingrese los campos Obligatorios.", @"Atención", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } var nueva = new NegocioDto { RazonSocial = txtRazonSocial.Text, Cuit = txtCuit.Text, Celular = txtCelular.Text, Direccion = txtDireccion.Text, Email = txtEmail.Text, Imagen = ImagenDb.Convertir_Imagen_Bytes(imgFotoEmpleado.Image), }; negocioServicio.Insertar(nueva); return(true); }