public async Task <Response <Exception, Genre> > CreateAsync(Genre genre) { var newGenre = _context.Genres.Add(genre).Entity; var saveCallback = await Response.Run(() => _context.SaveChangesAsync()); if (saveCallback.HasError) { return(saveCallback.Error); } return(newGenre); }
public async Task <Response <Exception, Movie> > CreateAsync(Movie movie) { var newMovie = _context.Add(movie).Entity; var saveCallback = await Response.Run(() => _context.SaveChangesAsync()); if (saveCallback.HasError) { return(saveCallback.Error); } return(newMovie); }
public async Task <Response <Exception, Rental> > CreateAsync(Rental rental) { var newRental = _context.Rentals.Add(rental).Entity; var saveCallback = await Response.Run(() => _context.SaveChangesAsync()); if (saveCallback.HasError) { return(saveCallback.Error); } return(newRental); }