public ActionResult Create(Cats.Models.Hubs.GiftCertificateViewModel giftcertificate) { if (ModelState.IsValid) { Cats.Models.Hubs.GiftCertificate giftCertificateModel = giftcertificate.GenerateGiftCertificate(); InsertGiftCertificate(giftcertificate, giftCertificateModel); //repository.Add( giftCertificate ); return RedirectToAction("Index"); } ViewBag.Commodities = _commodityService.GetAllCommodity().OrderBy(o => o.Name); ViewBag.CommodityTypes = _commodityTypeService.GetAllCommodityType().OrderBy(o => o.Name); ViewBag.DCurrencies = _detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.CURRENCY).OrderBy(o => o.SortOrder); ViewBag.DFundSources = _detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.FUND_SOURCE).OrderBy(o => o.SortOrder); ViewBag.DBudgetTypes = _detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.BUDGET_TYPE).OrderBy(o => o.SortOrder); ViewBag.Donors = new SelectList(_donorService.GetAllDonor().OrderBy(o => o.Name), "DonorID", "Name"); ViewBag.Programs = new SelectList(_programService.GetAllProgram(), "ProgramID", "Name"); ViewBag.DModeOfTransports = new SelectList(_detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.TRANSPORT_MODE).OrderBy(o => o.SortOrder), "DetailID", "Name"); //return the model with the values pre-populated return Create(); //GiftCertificateViewModel.GiftCertificateModel(giftcertificate)); }