Beispiel #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("MixTapeId,Title,Description")] MixTape mixTape)
        {
            if (id != mixTape.MixTapeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mixTape);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MixTapeExists(mixTape.MixTapeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Details", new { id = mixTape.MixTapeId }));
            }
            return(View(mixTape));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("MixTapeId,Title,Description")] MixTape mixTape)
        {
            if (ModelState.IsValid)
            {
                mixTape.MixTapeId = Guid.NewGuid();
                _context.Add(mixTape);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", new { id = mixTape.MixTapeId }));
            }
            return(View(mixTape));
        }