public ActionResult New()
        {
            var assetGroupVm = new AssetGroupViewModel()
            {
                AssetTypes = _assetTypeManager.GetAll()
            };

            return(View("AssetGroupForm", assetGroupVm));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,TagNumber,AssetTypeId,Manufacturer,Model,Description,SerialNumber")] Asset asset)
        {
            if (id != asset.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    AssetManager.Update(asset);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssetExists(asset.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssetTypeId"] = new SelectList(AssetTypeManager.GetAll(), "Id", "Name", asset.AssetTypeId);
            return(View(asset));
        }
        // GET: AssetTypes
        public ActionResult Index()
        {
            var assetTypes = AssetTypeManager.GetAll().
                             Select(at => new AssetTypesViewModel
            {
                Id       = at.Id,
                TypeName = at.Name,
            }).ToList();

            return(View(assetTypes));
        }
        public IActionResult Index()
        {
            var type      = AssetTypeManager.GetAll();
            var viewModel = type.Select(t => new AssetTypeViewModel
            {
                Id   = t.Id,
                Name = t.Name
            }).ToList();

            return(View(viewModel));
        }
Ejemplo n.º 5
0
        public IActionResult Index()
        {
            var filters = new AssetSearchViewModel();

            filters.Types = AssetTypeManager.GetAll().Select(t =>
                                                             new SelectListItem
            {
                Text  = t.Name,
                Value = t.Id.ToString()
            });
            return(View(filters));
        }
Ejemplo n.º 6
0
        //method to create the view for the asset types
        public IActionResult Index()
        {
            //call to the assets types manager class to get a list of all asset types
            //and create a new asset type view model
            var assets     = AssetTypeManager.GetAll();
            var viewModels = assets.Select(a => new AssetTypeViewModel
            {
                Name = a.Name
            })
                             .ToList();

            return(View(viewModels));
        }
        // GET: Assets
        public async Task <IActionResult> Index()
        {
            var assetTypes = AssetTypeManager.GetAll();
            List <SelectListItem> items = new SelectList(assetTypes, "Id", "Name").ToList();

            items.Insert(0, (new SelectListItem {
                Text = "ALL", Value = null
            }));
            ViewBag.AssetTypes = items;

            var assets = AssetManager.GetAll().ToList();

            return(View(assets));
        }
        public ActionResult New()
        {
            var assetEntryVm = new AssetEntryViewModel()
            {
                Organizations = _organizationManager.GetAll(),
                Branchs       = new List <Branch>()
                {
                },
                AssetLocations = new List <AssetLocation>()
                {
                },

                AssetTypes  = _assetTypeManager.GetAll(),
                AssetGroups = new List <AssetGroup>()
                {
                },
                AssetManufacurers = new List <AssetManufacurer>()
                {
                },
                AssetModels = new List <AssetModel>()
                {
                },
                Statuses = new List <Status>()
                {
                    new Status()
                    {
                        Id = true, Name = "Active"
                    },
                    new Status()
                    {
                        Id = false, Name = "Inactive"
                    }
                }
            };

            return(View("AssetEntryForm", assetEntryVm));
        }
        // GET: Assets/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var asset = AssetManager.Find((int)id);

            if (asset == null)
            {
                return(NotFound());
            }
            ViewData["AssetTypeId"] = new SelectList(AssetTypeManager.GetAll(), "Id", "Name", asset.AssetTypeId);
            return(View(asset));
        }
Ejemplo n.º 10
0
        // GET: AssetTypes/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var assetTypes = AssetTypeManager.GetAll().ToList();
            var assetType  = assetTypes.FirstOrDefault(m => m.Id == id);

            if (assetType == null)
            {
                return(NotFound());
            }

            return(View(assetType));
        }
Ejemplo n.º 11
0
        // GET: Asset/Create
        public ActionResult Create()
        {
            var model = new AssetAddViewModel
            {
                Types = AssetTypeManager.GetAll().Select(t =>
                                                         new SelectListItem {
                    Text = t.Name, Value = t.Id.ToString()
                }),
                Manufacturers = ManufacturerManager.GetAll().Select(m =>
                                                                    new SelectListItem {
                    Text = m.Name, Value = m.Id.ToString()
                })
            };

            return(View(model));
        }
        // GET: AssetType
        public ActionResult Index()
        {
            // because there is no view component for this Controller, we need to convert
            // AssetType objects from database to AssetTypeModels to be used in View

            var assetTypes = AssetTypeManager.GetAll();
            List <AssetTypeModel> assetTypeModels = new List <AssetTypeModel>();

            // Loop through AssetType List to convert to AssetTypeModel and add to list
            foreach (AssetType type in assetTypes)
            {
                assetTypeModels.Add(new AssetTypeModel {
                    Id = type.Id, Name = type.Name
                });
            }

            return(View(assetTypeModels));
        }
Ejemplo n.º 13
0
 public async Task <IActionResult> Create([Bind("Id,TagNumber,AssetTypeId,Manufacturer,Model,Description,SerialNumber")] Asset asset)
 {
     if (ModelState.IsValid)
     {
         try
         {
             // TODO: Add insert logic here
             AssetManager.Add(asset);
             return(RedirectToAction(nameof(Index)));
         }
         catch
         {
             return(View(asset));
         }
     }
     ViewData["AssetTypeId"] = new SelectList(AssetTypeManager.GetAll(), "Id", "Name", asset.AssetTypeId);
     return(View(asset));
 }
Ejemplo n.º 14
0
        public async Task <IActionResult> Search(int?assetTypeId)
        {
            var assetTypes = AssetTypeManager.GetAll();
            List <SelectListItem> items = new SelectList(assetTypes, "Id", "Name").ToList();

            items.Insert(0, (new SelectListItem {
                Text = "ALL", Value = null
            }));
            ViewBag.AssetTypes = items;
            if (assetTypeId == null)
            {
                var assets = AssetManager.GetAll().ToList();
                return(View(assets));
            }
            else
            {
                var assets = AssetManager.GetAllByAssetType((int)assetTypeId);
                return(View(assets));
            }
        }
        public JsonResult GetAllAssetType()
        {
            var assetTypes = _assetTypeManager.GetAll();

            return(Json(assetTypes, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 16
0
 // GET: Assets/Create
 public IActionResult Create()
 {
     ViewData["AssetTypeId"] = new SelectList(AssetTypeManager.GetAll(), "Id", "Name");
     return(View());
 }
Ejemplo n.º 17
0
        public IActionResult Index()
        {
            var assets = AssetTypeManager.GetAll();

            return(View(assets));
        }
Ejemplo n.º 18
0
        // GET: AssetTypes
        public async Task <IActionResult> Index()
        {
            var assetTypes = AssetTypeManager.GetAll().ToList();

            return(View(assetTypes));
        }