public IActionResult Aanpassen(long id) { KlantDetailViewModel vm = new KlantDetailViewModel(); Klant klant = klantrepository.GetById(id); vm = klantConverter.ModelToViewModel(klant); return(View(vm)); }
public IActionResult Aanpassen(KlantDetailViewModel vm, long id) { string rawValue = HttpContext.User.Identities.First().Claims.First().Value; if (string.IsNullOrEmpty(rawValue)) { return(View()); } if (long.TryParse(rawValue, out id)) { Klant klant = klantConverter.ViewModelToModel(vm); bool check = klantrepository.Update(klant); return(RedirectToAction("Index", new { vm.Id })); } return(View()); }
public IActionResult Index(long id) { string rawValue = HttpContext.User.Identities.First().Claims.First().Value; if (string.IsNullOrEmpty(rawValue)) { return(View()); } if (long.TryParse(rawValue, out id)) { KlantDetailViewModel vm = new KlantDetailViewModel(); Klant klant = klantrepository.GetById(id); vm = klantConverter.ModelToViewModel(klant); return(View(vm)); } return(View()); }