Beispiel #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var mov = await _context.Movies.Where(x => x.Id == id).FirstOrDefaultAsync();

            if (mov != null)
            {
                _context.Remove(mov);
                await _context.SaveChangesAsync();

                return(Ok(mov));
            }
            else
            {
                return(NotFound());
            }
        }
Beispiel #2
0
        public async Task <ActionResult <Movie> > Delete(int id)
        {
            try
            {
                Movie mov = await _context.Movies.SingleOrDefaultAsync(m => m.Id == id);

                if (mov != null)
                {
                    _context.Remove(mov);
                    await _context.SaveChangesAsync();

                    return(Ok(mov));
                }
                else
                {
                    return(NotFound("Record not found..."));
                }
            }
            catch (Exception e)
            {
                return(BadRequest("Exception..." + e.Message));
            }
        }
Beispiel #3
0
 public void Delete(Show show)
 {
     db.Remove(show);
     db.SaveChanges();
 }