public async Task <IActionResult> Create([Bind("Id,Type")] BokType bokType) { if (ModelState.IsValid) { _context.Add(bokType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bokType)); }
public async Task <IActionResult> Eier(EierViewModel model) { if (!ModelState.IsValid) { return(View(model)); } Eier eier = new Eier { Navn = model.Navn, UserId = model.UserId }; await _context.Eiere.AddAsync(eier); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Eier))); }