public ActionResult View(int assetId)
        {
            var repo  = new AssetRepository();
            var asset = repo.GetAsset(assetId);

            if (asset == null)
            {
                return(HttpNotFound());
            }
            return(View(new AssetDetailsModel(asset)
            {
                GroupName = asset.Group.Name
            }));
        }
        private AssetDetailsModel AddEdit(int assetId)
        {
            var repo  = new AssetRepository();
            var asset = assetId == 0 ? new Asset() : repo.GetAsset(assetId);

            if (asset == null)
            {
                return(null);
            }
            var groups = repo.GetGroups();

            return(new AssetDetailsModel(asset)
            {
                Groups = groups.Select(g =>
                                       new SelectListItem {
                    Selected = asset.GroupId == g.Id, Text = g.Name, Value = g.Id.ToString()
                })
            });
        }