コード例 #1
0
        public MovieTypeContract CreateMovieType(MovieTypeContract contract)
        {
            try
            {
                using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString))
                {
                    var provider = new MovieTypeDal(context);
                    var process = new MovieTypeProcess(provider);
                    var service = new MovieTypeService(process);

                    var result = service.Create(new MovieType(contract));
                    var returnResult = new MovieType().ConvertToContract(result, new MovieTypeContract());
                    return returnResult;
                }

            }
            catch (Exception exception)
            {
                return HandleExceptionResponse<MovieType, MovieTypeContract>(exception);
            }
        }
コード例 #2
0
        public DomainListContract<MovieTypeContract> SaveAllMovieTypes(DomainListContract<MovieTypeContract> contract)
        {
            try
            {
                using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString))
                {
                    var provider = new MovieTypeDal(context);
                    var process = new MovieTypeProcess(provider);
                    var service = new MovieTypeService(process);

                    var domainList = new MovieType().ConvertToDomain<MovieType, IEnumerable<MovieType>, MovieTypeContract>(contract);
                    var result = service.SaveAll(domainList);
                    var returnResult = new MovieType().ConvertToContract<MovieType, IEnumerable<MovieType>, MovieTypeContract>(result);
                    return returnResult;
                }

            }
            catch (Exception exception)
            {
                return HandleExceptionResponse<MovieTypeContract>(exception);
            }
        }
コード例 #3
0
        public DomainStatusContract RemoveMovieType(int id)
        {
            try
            {
                using (var context = new MovieShelfEntities(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString))
                {
                    var provider = new MovieTypeDal(context);
                    var process = new MovieTypeProcess(provider);
                    var service = new MovieTypeService(process);

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

            }
            catch (Exception exception)
            {
                return HandleExceptionResponse(exception);
            }
        }