public ViewResult Create([Bind(Exclude = "Id")] AccountInfoEditModel model) { if (!ModelState.IsValid) { return(View("Create", model)); } try { var result = _accountInfoService.SaveOneAccountInfo(model.AccountInfo); if (result == StorageResult.Success) { model.FillDropDownLists(); ViewData["Message"] = "Kontoinformasjonen er opprettet"; return(View("Create", model)); } if (result == StorageResult.AllreadyExsists) { model.FillDropDownLists(); ViewData["Message"] = "Kontoinformasjon med samme nummer og år finnes fra før."; return(View("Create", model)); } model.FillDropDownLists(); ViewData["Message"] = "Ukjent feil under lagring."; return(View("Create", model)); } catch { model.FillDropDownLists(); ViewData["Message"] = "Feil i underliggende tjenester under lagring."; return(View("Create", model)); } }
public ViewResult Create() { var model = new AccountInfoEditModel(); model.FillDropDownLists(); return(View("Create", model)); }
public ViewResult Edit(Guid id) { var model = new AccountInfoEditModel { AccountInfo = _accountInfoService.GetOneAccountInfoById(id) }; model.FillDropDownLists(); return(View(model)); }
public ViewResult Create() { var model = new AccountInfoEditModel(); model.FillDropDownLists(); return View("Create", model); }
public ViewResult Edit(Guid id) { var model = new AccountInfoEditModel { AccountInfo = _accountInfoService.GetOneAccountInfoById(id) }; model.FillDropDownLists(); return View(model); }