Beispiel #1
0
        public JsonResult AddToListingMovie(int id)
        {
            var getMovieById = _movieService.GetMovieById(id);
            var CheckIfExistsInListingMovie = _listingMovieService.GetListingMovieByMovieId(id);

            if (CheckIfExistsInListingMovie == null)
            {
                var userId       = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                var movieId      = getMovieById.Id;
                var directorId   = getMovieById.DirectorID;
                var genreId      = getMovieById.GenreID;
                var listingMovie = new ListingMovie
                {
                    UserId     = userId,
                    MovieId    = movieId,
                    DirectorId = directorId,
                    GenreId    = genreId,
                    DateAdded  = DateTime.Now
                };
                _listingMovieService.Add(listingMovie);
                return(new JsonResult(new { data = listingMovie }));
            }
            else
            {
                return(new JsonResult(new { data = "" }));
            }
        }
 public void Edit(ListingMovie listingMovie)
 {
     try
     {
         _listingMovieRepository.Edit(listingMovie);
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieEdited);
     }catch (Exception ex)
     {
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieEditedError, ex);
     }
 }
Beispiel #3
0
 public void Edit(ListingMovie listingMovie)
 {
     try
     {
         _context.ListingMovies.Update(listingMovie);
         _context.SaveChanges();
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieEdited);
     }catch (Exception ex)
     {
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieEditedError, ex);
     }
 }
 public void Add(ListingMovie listingMovie)
 {
     try
     {
         _listingMovieRepository.Add(listingMovie);
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieCreated);
     }
     catch (Exception ex)
     {
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieCreatedNotFound, ex);
     }
 }
Beispiel #5
0
 public void Add(ListingMovie listingMovie)
 {
     try
     {
         _context.ListingMovies.Add(listingMovie);
         _context.SaveChanges();
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieCreated);
     }
     catch (Exception ex)
     {
         _logger.LogInformation(LoggerMessageDisplay.ListedMovieCreatedNotFound, ex);
     }
 }