public IEnumerable <string> Execute(IEnumerable <string> input)
        {
            var parameters = input.ToList();

            cinemaConsole.Clear();
            cinemaConsole.WriteLineMiddle("Type a movie name:\n");

            try
            {
                string movieName = cinemaConsole.ReadLineMiddle().TrimEnd().TrimStart();
                Validations(movieName);
                movieServices.DeleteMovie(movieName);
                cinemaConsole.HandleOperation("\nSuccessfully deleted from database");
                return(parameters.Skip(1));
            }
            catch (InvalidClientInputException e)
            {
                cinemaConsole.HandleException(e.Message);
                return(parameters.Skip(1));
            }
            catch (EntityDoesntExistException e)
            {
                cinemaConsole.HandleException(e.Message);
                return(parameters.Skip(1));
            }
        }
Exemple #2
0
 public bool Delete(string movie_name)
 {
     if (movie_name != null)
     {
         return(_movieServices.DeleteMovie(movie_name));
     }
     return(false);
 }
Exemple #3
0
        public IActionResult DeleteMovie(int id)
        {
            if (movieServices.DeleteMovie(id))
            {
                return(NoContent());
            }

            return(NotFound());
        }
        public ActionResult DeleteMovie(int movieId)
        {
            try
            {
                var resultData = movieServices.DeleteMovie(movieId);

                return(Ok(ServicesExtension.SuccessfulResult(resultData)));
            }
            catch (Exception exp)
            {
                return(new JsonResult(ServicesExtension.ErrorResult(exp)));
            }
        }
Exemple #5
0
        public string Run(IList <string> parameters)
        {
            Validator.IfNull <ArgumentNullException>(parameters, "Parameters cannot be null!");

            if (parameters.Count != 1)
            {
                return($"{FAILED_SYNTAX}\nTry: {CMD_FORMAT}");
            }

            bool isParse = int.TryParse(parameters[0], out int ID);

            if (!isParse)
            {
                return($"{FAILED_SYNTAX}\nTry: {CMD_FORMAT}");
            }

            movieServices.DeleteMovie(ID);

            return($"Movie with ID: {ID} deleted successfully");
        }