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); } }
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); } }
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); } }
//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; }