コード例 #1
0
 public long Agregar(MotivoReservaDto dto)
 {
     using (var context = new ModeloXCommerceContainer())
     {
         var MotivoAgregar = new AccesoDatos.MotivoReserva();
         MotivoAgregar.Descripcion = dto.Descripcion;
         context.MotivoReservas.Add(MotivoAgregar);
         context.SaveChanges();
         return(MotivoAgregar.Id);
     }
 }
コード例 #2
0
 public void Modificar(MotivoReservaDto dto)
 {
     using (var context = new ModeloXCommerceContainer())
     {
         var motivoModificar = context.MotivoReservas.FirstOrDefault(x => x.Id == dto.Id);
         if (motivoModificar == null)
         {
             throw new Exception("No se encontro el Motivo de Reserva");
         }
         motivoModificar.Id          = dto.Id;
         motivoModificar.Descripcion = dto.Descripcion;
         context.SaveChanges();
     }
 }
コード例 #3
0
        public override bool EjecutarComandoNuevo()
        {
            if (!VerificarDatosObligatorios())
            {
                MessageBox.Show(@"Por favor ingrese los campos Obligatorios.", @"Atención", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }

            var nuevaMotivoReserva = new MotivoReservaDto
            {
                Descripcion = txtDescripcion.Text,
            };

            _motivoreservaServicio.Agregar(nuevaMotivoReserva);

            return(true);
        }
コード例 #4
0
        public override bool EjecutarComandoModificar()
        {
            if (!VerificarDatosObligatorios())
            {
                MessageBox.Show(@"Por favor ingrese los campos Obligatorios.", @"Atención", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }

            var motivoServicioParaModificar = new MotivoReservaDto()
            {
                Id          = EntidadId.Value,
                Descripcion = txtDescripcion.Text
            };

            _motivoreservaServicio.Modificar(motivoServicioParaModificar);

            return(true);
        }