Ejemplo n.º 1
0
        // GET CREATE ASSET
        public ViewResult Create(int ClientID)
        {
            // create view model
            var viewModel = new FinancialAssetFormViewModel
            {
                clientId = ClientID
            };

            return View("Edit", viewModel);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(FinancialAssetFormViewModel assetForm)
        {
            var asset = Mapper.Map<FinancialAssetFormViewModel, FinancialAsset>(assetForm);

            if (ModelState.IsValid)
            {
                clientsRepository.SaveFinancialAsset(asset);
                TempData["message"] = "Asset: " + asset.AssetName + " has been saved.";
                return RedirectToAction("List", "LegalFinance", new { asset.ClientId });
            }
            else // validation error, so redisplay the same view
                return View("Edit", assetForm);
        }