示例#1
0
        public void RegistrarComanda()
        {
            List <Mercaderia> listaMercaderias = _repositoryComandaMercaderia.SeleccionarMercaderia();
            int total          = CalcularPrecioTotal(listaMercaderias);
            int idFormaEntrega = SeleccionarFormaEntrega();

            if (idFormaEntrega == 0)
            {
                Console.WriteLine("Mal ingresado, no corresponde a ninguna forma de entrega");
            }
            else
            {
                var entity = new Comanda
                {
                    ComandaId      = new Guid(),
                    FormaEntregaId = idFormaEntrega,
                    PrecioTotal    = total,
                    Fecha          = new DateTime()
                };

                _repository.Add(entity);

                Console.WriteLine("Se registro con exito la comanda");
                foreach (var item in listaMercaderias)
                {
                    Abm_ComandaMercaderia.getInstance().RegistrarComandaMercaderia(item.MercaderiaId, entity.ComandaId);
                }
            }
        }
 public static Abm_ComandaMercaderia getInstance()
 {
     if (unicoabm_ComandaMercaderia == null)
     {
         unicoabm_ComandaMercaderia = new Abm_ComandaMercaderia();
     }
     return(unicoabm_ComandaMercaderia);
 }