Esempio n. 1
0
        public async Task <ActionResult <List <Unit> > > GetAsync(CancellationToken cancellationToken)
        {
            try
            {
                var units = await _unitManager.GetAll();

                return(units);
            }
            catch (Exception ex)
            {
                _logger.LogError("An error has been thrown in UnitController:GetAsync");
                return(BadRequest(ex));
            }
        }
        public ActionResult Create()
        {
            var location = _locationManager.GetAll().ToList();
            var unit     = _unitManager.GetAll().ToList();
            var host     = _hostManager.GetAll().ToList();

            InventoryViewModel inventory = new InventoryViewModel
            {
                Locations = location,
                Units     = unit,
                Hosts     = host
            };

            return(View(inventory));
        }
 // GET: Department
 public ActionResult Index()
 {
     try
     {
         var _units = _unit.GetAll();
         var ulvm   = new UnitListViewModel
         {
             Units = _units
         };
         return(View(ulvm));
     }
     catch (Exception ex)
     {
         //Log exception
         return(View(ex.Message, "Error"));
     }
 }