예제 #1
0
        public MovieDetailContract CreateMovieDetail(MovieDetailContract contract)
        {
            try
            {
                using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString))
                {
                    var provider = new MovieDetailDal(context);
                    var process = new MovieDetailProcess(provider);
                    var service = new MovieDetailService(process);

                    var result = service.Create(new MovieDetail(contract));
                    return new MovieDetail().ConvertToContract(result, new MovieDetailContract());
                }

            }
            catch (Exception exception)
            {
                return HandleExceptionResponse<MovieDetail, MovieDetailContract>(exception);
            }
        }
예제 #2
0
        public DomainListContract<MovieDetailContract> FetchAllMovieDetails(bool includeDeletion)
        {
            try
            {
                using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString))
                {
                    var provider = new MovieDetailDal(context);
                    var process = new MovieDetailProcess(provider);
                    var service = new MovieDetailService(process);

                    var result = service.GetAll(includeDeletion);
                    var returnResult = new MovieDetail().ConvertToContract<MovieDetail, IEnumerable<MovieDetail>, MovieDetailContract>(result);
                    return returnResult;
                }

            }
            catch (Exception exception)
            {
                return HandleExceptionResponse<MovieDetailContract>(exception);
            }
        }
예제 #3
0
        public DomainStatusContract RemoveMovieDetail(int id)
        {
            try
            {
                using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString))
                {
                    var provider = new MovieDetailDal(context);
                    var process = new MovieDetailProcess(provider);
                    var service = new MovieDetailService(process);

                    var result = service.Remove(id);
                    return DomainStatus.ConvertToContract(result);
                }

            }
            catch (Exception exception)
            {
                return HandleExceptionResponse(exception);
            }
        }
예제 #4
0
        //private readonly CommentService _commentSrv;
        //private readonly SearchService _searchSrv;
        //TODO REPLACE CONSTRUCTOR
        //public HomeController(MovieDetailService _movieDetailService, CommentService _commentService, SearchService _searchService)

        public HomeController(MovieDetailService _movieDetailService)
        {
            _movieSrv = _movieDetailService;
            //_commentSrv = _commentService;
            //_searchSrv = _searchService;
        }