コード例 #1
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _blog = context.BlogTable.FirstOrDefault();
            if (_blog == null)
            {
                var Blog = new Domain.Models.Blog()
                {
                    ID               = DateTime.Now.Ticks.ToString(),
                    Title            = "test",
                    ShortText        = "test short text",
                    ImageFileAddress = "test",
                    TextFileAddress  = "test file ",
                    TimeToRead       = 10,
                    Writer           = "test writer",
                    Date             = DateTime.Now,
                    ReadCount        = 0,
                    Category         = context.CategoryTable.FirstOrDefault()
                };

                context.BlogTable.Add(Blog);
                context.SaveChanges();

                _blog = Blog;
            }
        }
コード例 #2
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _gallery = context.GalleryTable.FirstOrDefault();
            _project = context.ProjectTable.FirstOrDefault();
            _product = context.ProductTable.FirstOrDefault();

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    State            = "0",
                    Status           = true,
                    TextFileAddress  = "test",
                    TimeToFinish     = 150
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }

            if (_product == null)
            {
                var Product = new Domain.Models.Product()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    Status           = true,
                    TextFileAddress  = "test"
                };
                context.ProductTable.Add(Product);
                context.SaveChanges();
                _product = Product;
            }

            if (_gallery == null)
            {
                var Gallery = new Domain.Models.Gallery()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Description      = "some test",
                    Project          = _project,
                    Product          = _product
                };

                context.GalleryTable.Add(Gallery);
                context.SaveChanges();
                _gallery = Gallery;
            }
        }
コード例 #3
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _platform = context.PlatformTable.FirstOrDefault();
            _project  = context.ProjectTable.FirstOrDefault();
            _product  = context.ProductTable.FirstOrDefault();

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    State            = "0",
                    Status           = true,
                    TextFileAddress  = "test",
                    TimeToFinish     = 150
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }

            if (_product == null)
            {
                var Product = new Domain.Models.Product()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    Status           = true,
                    TextFileAddress  = "test"
                };
                context.ProductTable.Add(Product);
                context.SaveChanges();
                _product = Product;
            }

            if (_platform == null)
            {
                var Platform = new Domain.Models.Platform()
                {
                    ID              = DateTime.Now.Ticks.ToString(),
                    Name            = "test",
                    IconFileAddress = "test Icon"
                };

                context.PlatformTable.Add(Platform);
                _platform = Platform;
            }
        }
コード例 #4
0
ファイル: UnitOfWork.cs プロジェクト: anishtain/MahourTeam
 public UnitOfWork(Domain.DataAccess.MahourContext context)
 {
     this._context                   = context;
     this._adminRepository           = new Repositories.Implementions.AdminRepository(this._context);
     this._blogRepository            = new Repositories.Implementions.BlogRepository(this._context);
     this._categoryRepository        = new Repositories.Implementions.CategoryRepository(this._context);
     this._colorProjectRepository    = new Repositories.Implementions.ColorProjectRepository(this._context);
     this._colorRepository           = new Repositories.Implementions.ColorRepository(this._context);
     this._galleryRepository         = new Repositories.Implementions.GalleryRepository(this._context);
     this._platformRepository        = new Repositories.Implementions.PlatformRepository(this._context);
     this._platformProductRepository = new Repositories.Implementions.PlatformProductRepository(this._context);
     this._platformProjectRepository = new Repositories.Implementions.PlatformProjectRepository(this._context);
     this._productRepository         = new Repositories.Implementions.ProductRepository(this._context);
     this._projectRepository         = new Repositories.Implementions.ProjectRepository(this._context);
 }
コード例 #5
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _color = context.ColorTable.FirstOrDefault();

            if (_color == null)
            {
                var Color = new Domain.Models.Color()
                {
                    ID   = DateTime.Now.Ticks.ToString(),
                    Code = "#123587",
                };

                context.ColorTable.Add(Color);
                _color = Color;
            }
        }
コード例 #6
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _category = context.CategoryTable.FirstOrDefault();

            if (_category == null)
            {
                var Category = new Domain.Models.Category()
                {
                    ID   = DateTime.Now.Ticks.ToString(),
                    Name = "test"
                };

                context.CategoryTable.Add(Category);
                _category = Category;
            }
        }
コード例 #7
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            if (_product == null)
            {
                var Product = new Domain.Models.Product()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    Status           = true,
                    TextFileAddress  = "test"
                };
                context.ProductTable.Add(Product);
                context.SaveChanges();
                _product = Product;
            }
        }
コード例 #8
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _color   = context.ColorTable.FirstOrDefault();
            _project = context.ProjectTable.FirstOrDefault();

            if (_color == null)
            {
                var Color = new Domain.Models.Color()
                {
                    ID   = DateTime.Now.Ticks.ToString(),
                    Code = "#123456"
                };
                context.ColorTable.Add(Color);
                context.SaveChanges();
                _color = Color;
            }

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    State            = "0",
                    Status           = true,
                    TextFileAddress  = "test",
                    TimeToFinish     = 150
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }
        }
コード例 #9
0
 public GenericRepository(Domain.DataAccess.MahourContext context)
 => _context = context.Set <T>();
コード例 #10
0
 public BlogRepository(Domain.DataAccess.MahourContext context) : base(context)
     => this._context = context;
コード例 #11
0
 public PlatformProductRepository(Domain.DataAccess.MahourContext context) : base(context)
     => this._context = context;
コード例 #12
0
 public ColorProjectRepository(Domain.DataAccess.MahourContext context) : base(context)
     => this._context = context;