public long Insertar(MotivoBajaDTO dto) { using (var context = new ModeloXCommerceContainer()) { var motivoBajaNuevo = new AccesoDatos.MotivoBaja { Descripcion = dto.Descripcion }; context.MotivosBajas.Add(motivoBajaNuevo); context.SaveChanges(); return(motivoBajaNuevo.Id); } }
/*public override void CargarDatos(long? entidadId) * { * if (!entidadId.HasValue) * { * MessageBox.Show(@"Ocurrio un Error Grave", @"Error Grave", MessageBoxButtons.OK, MessageBoxIcon.Stop); * * this.Close(); * } * * if (TipoOperacion == TipoOperacion.Eliminar) * { * btnLimpiar.Enabled = false; * } * * var provincia = _motivoBajaServicio.ObtenerPorId(entidadId.Value); * * }*/ public override bool EjecutarComandoNuevo() { if (!VerificarDatosObligatorios()) { MessageBox.Show(@"Por favor ingrese los campos Obligatorios.", @"AtenciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } var motivoBajaNuevo = new MotivoBajaDTO { Descripcion = txtMotivoBaja.Text, }; _motivoBajaServicio.Insertar(motivoBajaNuevo); return(true); }