public IActionResult Create(AssetType assetType) { try { AssetTypeManager.Add(assetType); return(Redirect("/Successful.html")); } catch { return(View()); } }
public IActionResult Create(AssetType type) { try { AssetTypeManager.Add(type); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(AssetType assetType) { try { AssetTypeManager.Add(assetType); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public IActionResult Create(AssetType assetType) { try { AssetTypeManager.Add(assetType); return(RedirectToAction("Create", "Asset")); } catch { return(View()); } }
public IActionResult Create(AssetType asset) { try { AssetTypeManager.Add(asset); // call the add method from manager return(RedirectToAction("Index")); //redirect back to list of asset types } catch { return(View()); } }
public ActionResult Create(AssetType assetType) { try { // call the Method to add an assetType - see AssetType manager class AssetTypeManager.Add(assetType); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public IActionResult Create(AssetType assetType) { try { // TODO: Add insert logic here for Owner AssetTypeManager.Add(assetType); return(RedirectToAction("Search", "Assets")); } catch { return(View()); } }
public async Task <IActionResult> Create([Bind("Id,Name")] AssetType assetType) { if (ModelState.IsValid) { try { // TODO: Add insert logic here AssetTypeManager.Add(assetType); return(RedirectToAction(nameof(Index))); } catch { return(View()); } } return(RedirectToAction(nameof(Index))); }
public IActionResult Create(AssetTypeViewModel newAssetTypeMV) { var newAssetType = new AssetType() { Name = newAssetTypeMV.Name }; try { AssetTypeManager.Add(newAssetType); return(RedirectToAction("Index", "Home")); } catch { return(View()); } }
public ActionResult Create(AssetTypeModel assetTypeModel) { try { // Create new AssetType object from model to pass into database var assetType = new AssetType { Id = assetTypeModel.Id, Name = assetTypeModel.Name }; AssetTypeManager.Add(assetType); return(RedirectToAction("Index", "Asset")); } catch { return(View()); } }
public ActionResult Save(AssetTypeViewModel assetTypeVm) { ModelState.Remove("Id"); if (ModelState.IsValid) { if (assetTypeVm.Id == 0) { bool isShortNameExist = _assetTypeManager.IsShortNameExsit(assetTypeVm.ShortName); if (isShortNameExist) { ViewBag.Message = "This Type Short Name already Exist"; return(View("AssetTypeForm")); } var assetType = new AssetType() { Id = assetTypeVm.Id, Name = assetTypeVm.Name, ShortName = assetTypeVm.ShortName, Code = assetTypeVm.Code }; _assetTypeManager.Add(assetType); ModelState.Clear(); return(View("AssetTypeForm")); } var assetTypeInDb = _assetTypeManager.Get(assetTypeVm.Id); assetTypeInDb.Id = assetTypeVm.Id; assetTypeInDb.Name = assetTypeVm.Name; assetTypeInDb.ShortName = assetTypeVm.ShortName; assetTypeInDb.Code = assetTypeVm.Code; _assetTypeManager.Update(assetTypeInDb); ModelState.Clear(); return(View("AssetTypeList")); } return(View("AssetTypeForm", assetTypeVm)); }