public IActionResult GenerarToma(TomaViewModel model)
        {
            try
            {
                var toma = new TbPrToma
                {
                    IdBodega  = model.IdBodega,
                    FechaToma = model.FechaToma,
                    Ordenado  = model.Ordenado
                };
                var tomas = service.GenerateTD(toma);

                foreach (var item in tomas)
                {
                    item.IdInventarioNavigation.TbPrInventarioBodega = null;
                    item.IdInventarioNavigation.TbPrAjusteInventario = null;
                    item.IdInventarioNavigation.TbPrTomaDetalle      = null;
                    //item.IdInventarioNavigation.IdSubFamiliaNavigation.TbPrInventario = null;
                }

                //if(model.Ordenado == "producto")
                //    return Ok(tomas.OrderBy(o=>o.IdInventarioNavigation.Descripcion));
                //else
                return(Json(new { tomas = tomas, esInicial = service.ExisteTomaInicial((int)toma.IdBodega) }));
            }
            catch (Exception ex)
            {
                AltivaLog.Log.Insertar(ex.ToString(), "Error");
                throw;
            }
        }
Beispiel #2
0
 public TomaViewModel DomainToViewModel(TbPrToma domain)
 {
     return(new TomaViewModel {
         Anulado = domain.Anulado,
         Borrador = domain.Borrador,
         EsInicial = domain.EsInicial,
         FechaToma = domain.FechaToma,
         Id = domain.Id,
         IdBodega = domain.IdBodega,
         Ordenado = domain.Ordenado,
         IdUsuarioCreacion = domain.IdUsuarioCreacion
     });
 }
        private TbPrToma GestionaToma(TomaViewModel viewModel)
        {
            var toma = new TbPrToma();

            if (viewModel.Id != 0)
            {
                toma = map.Update(viewModel);
                if (viewModel.TomaDetalle != null)
                {
                    var tomaDetalle = map.UpdateTD(viewModel.TomaDetalle);
                }
            }
            else
            {
                toma = map.Create(viewModel);
            }

            return(toma);
        }
Beispiel #4
0
 public TbPrToma Update(TbPrToma domain)
 {
     return(repository.Update(domain));
 }
Beispiel #5
0
 public TbPrToma Save(TbPrToma domain)
 {
     return(repository.Save(domain));
 }
Beispiel #6
0
 public IList <TbPrTomaDetalle> GenerateTD(TbPrToma domain)
 {
     return(repository.GenerateTD(domain));
 }