Пример #1
0
        public ActionResult ListarSubFamilias(int id)
        {
            var familias = service.GetFamiliaById(id);

            ViewData["usuarios"] = userService.GetAllByIdEmpresa((int)HttpContext.Session.GetInt32("idEmpresa"));
            return(PartialView("_ListarSubFamilias", familias));
        }
Пример #2
0
        public TbPrFamilia ViewModelToDomainEditar(int id, FamiliaViewModel viewmodel)
        {
            var familia = service.GetFamiliaById(id);

            familia.Descripcion = viewmodel.Descripcion;
            //familia.IdFamilia = viewmodel.IdFamilia;

            if (familia.IdFamilia == null && viewmodel.IdFamilia != null)
            {
                if (familia.InverseIdFamiliaNavigation.Count != 0)
                {
                    foreach (var item in familia.InverseIdFamiliaNavigation)
                    {
                        item.IdFamilia = (int?)viewmodel.IdFamilia;
                    }

                    service.UpdateSubFamilia(familia.InverseIdFamiliaNavigation.ToList());
                }
            }

            familia.IdFamilia = viewmodel.IdFamilia;


            return(familia);
        }