예제 #1
0
        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));
            }
        }
예제 #2
0
        public ViewResult Create()
        {
            var model = new AccountInfoEditModel();

            model.FillDropDownLists();
            return(View("Create", model));
        }
예제 #3
0
        public ViewResult Edit(Guid id)
        {
            var model = new AccountInfoEditModel
            {
                AccountInfo = _accountInfoService.GetOneAccountInfoById(id)
            };

            model.FillDropDownLists();
            return(View(model));
        }
예제 #4
0
 public ViewResult Create()
 {
     var model = new AccountInfoEditModel();
     model.FillDropDownLists();
     return View("Create", model);
 }
예제 #5
0
 public ViewResult Edit(Guid id)
 {
     var model = new AccountInfoEditModel
                     {
                         AccountInfo = _accountInfoService.GetOneAccountInfoById(id)
                     };
     model.FillDropDownLists();
     return View(model);
 }