public ActionResult Create() { CatalogEntryModel catalogEntryModel = new CatalogEntryModel(); catalogEntryModel.LicensingBases = _licenseTypeService.GetLicensingBases(); return(View(catalogEntryModel)); }
public ActionResult Details(int id = 0) { CatalogEntry catalogEntry = _catalogService.TryGet(id); CatalogEntryModel catalogEntryModel = catalogEntry.ToViewModel(); if (catalogEntry == null) { return(HttpNotFound()); } return(View(catalogEntryModel)); }
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)); }
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)); }
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); }
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); }