예제 #1
0
        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));
        }
예제 #2
0
        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));
        }