コード例 #1
0
        public ActionResult Create()
        {
            CatalogEntryModel catalogEntryModel = new CatalogEntryModel();

            catalogEntryModel.LicensingBases = _licenseTypeService.GetLicensingBases();
            return(View(catalogEntryModel));
        }
コード例 #2
0
        public ActionResult Details(int id = 0)
        {
            CatalogEntry      catalogEntry      = _catalogService.TryGet(id);
            CatalogEntryModel catalogEntryModel = catalogEntry.ToViewModel();

            if (catalogEntry == null)
            {
                return(HttpNotFound());
            }
            return(View(catalogEntryModel));
        }
コード例 #3
0
        public ActionResult Create(CatalogEntryModel catalogEntryModel)
        {
            CatalogEntry entry = catalogEntryModel.ToServiceModel();

            if (ModelState.IsValid)
            {
                _catalogService.Add(entry);
                return(RedirectToAction("Index"));
            }
            catalogEntryModel.LicensingBases = _licenseTypeService.GetLicensingBases();
            return(View(catalogEntryModel));
        }
コード例 #4
0
        public ActionResult Edit(int id = 0)
        {
            CatalogEntry catalogEntry = _catalogService.TryGet(id);

            if (catalogEntry == null)
            {
                return(HttpNotFound());
            }
            CatalogEntryModel catalogEntryModel = catalogEntry.ToViewModel();

            catalogEntryModel.LicensingBases = _licenseTypeService.GetLicensingBases();
            return(View(catalogEntryModel));
        }
コード例 #5
0
        public static CatalogEntry ToServiceModel(this CatalogEntryModel model)
        {
            CatalogEntry entry = new CatalogEntry
            {
                Id             = model.Id,
                ProductName    = model.ProductName,
                ProductVersion = model.ProductVersion,
                Blurb          = model.Blurb,
                Price          = model.Price,
                SkuId          = model.SkuId,
                LicensingBasis = model.LicensingBasis
            };

            return(entry);
        }
コード例 #6
0
        public static CatalogEntryModel ToViewModel(this CatalogEntry model)
        {
            CatalogEntryModel catalogEntryModel = new CatalogEntryModel
            {
                Id             = model.Id,
                ProductName    = model.ProductName,
                ProductVersion = model.ProductVersion,
                Blurb          = model.Blurb,
                Price          = model.Price,
                SkuId          = model.SkuId,
                LicensingBasis = model.LicensingBasis
            };

            return(catalogEntryModel);
        }