// GET: Create public async Task<ActionResult> Create() { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); CharacterChartViewModel Model = new CharacterChartViewModel(new CharacterChart(user)); return View(Model); }
public async Task<ActionResult> Create(CharacterChartViewModel Model) { if (ModelState.IsValid) { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); CharacterChart Chart = new CharacterChart(Request.Form); CharacterChartDbModel ChartModel_DB = new CharacterChartDbModel(Chart,user); ChartModel_DB = db.CharacterCharts.Add(ChartModel_DB); await db.SaveChangesAsync(); return RedirectToAction("Success", new { ChartID = ChartModel_DB.ChartID }); } return View(Model); }