Exemplo n.º 1
0
 public MoviesViewModel Handle(GetMoviesById message)
 {
     try
     {
         string validateModel = message == null ? "Command model is null, bad request" : message.ValidateModel();
         if (string.IsNullOrEmpty(validateModel))
         {
             var queryService = new ServiceQuery();
             var movies       = queryService.GetMoviesById(message.Id);
             return(new MoviesViewModel
             {
                 Id = message.Id,
                 IsDeleted = (bool)movies.IsDeleted,
                 ReleaseDate = movies.ReleaseDate,
                 RunningTime = (int)movies.RunningTime,
                 Title = movies.Title,
                 Rating = movies.Rating,
                 Discription = movies.Discription,
                 BookingId = movies.BookingId
             });
         }
         throw new System.Exception(validateModel);
     }
     catch (System.Exception)
     {
         throw;
     }
 }