public TerminalGeneralVM GetGeneralInfo(int id)
        {
            try
            {
                Terminal terminal;
                if (id > 0)
                {
                    terminal = Table
                               .Include(m => m.Partner)
                               .Include(m => m.Country)
                               .Include(m => m.State)
                               .Include(m => m.LocationType)
                               .Include(m => m.Make)
                               .Include(m => m.Model)
                               .FirstOrDefault(m => m.Id == id);
                }
                else
                {
                    terminal = new Terminal();
                }

                TerminalGeneralVM viewModel = Mapper.Map <Terminal, TerminalGeneralVM>(terminal);

                return(viewModel);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public PartialViewResult GetGeneralInfo(int id)
        {
            try
            {
                TerminalGeneralVM viewModel;
                if (id > 0)
                {
                    viewModel = _repository.GetGeneralInfo(id);
                }
                else
                {
                    viewModel = new TerminalGeneralVM();
                }

                return(PartialView("Sections/GeneralInfo", viewModel));
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Error: " + ex.Message;
                return(PartialView("Sections/Error"));
            }
        }