public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Description,Url,File")] Tonality tonality) { if (ModelState.IsValid) { db.Entry(tonality).State = EntityState.Modified; tonality.UploadFile(); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tonality)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description,Url,File")] Tonality tonality) { if (ModelState.IsValid) { db.Tonalities.Add(tonality); await db.SaveChangesAsync(); tonality.UploadFile(); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tonality)); }