public async Task <IActionResult> UpdateExpense(SplitExpenseVM viewModel, int id) { if (!ModelState.IsValid) { return(View(viewModel)); } //Hämta currentUser var myUser = await userManager.GetUserAsync(HttpContext.User); User currentUser = mysticoContext.GetUserByAspUserId(myUser.Id); //Hämta specifikt expense som ska ändras var myExpense = mysticoContext.GetExpenseById(id); //OM jag inte är inköpare ==> skickas till overview if (myExpense.PurchaserId != currentUser.Id && (myExpense.PurchaserId < 32 || myExpense.PurchaserId > 47)) { return(RedirectToAction(nameof(SplitController.Details), nameof(SplitController).Replace("Controller", ""), new { id = myExpense.EventId })); } await mysticoContext.UpdateExpense(myExpense, viewModel); return(RedirectToAction(nameof(SplitController.Details), nameof(SplitController).Replace("Controller", ""), new { id = myExpense.EventId })); }