static void Main(string[] args) { var context = new SWDContext(); var blogs = new Repository <Blog>(context); var posts = new Repository <Post>(context); var uow = new UnitOfWork(context); var blog = blogs.Insert(new Blog { Name = "post one" }); posts.Insert(new Post { Blog_Id = blog.Id, Content = "This is content", Time = DateTime.Now }); uow.Complete(); foreach (var allBlog in blogs.GetAll()) { Console.WriteLine($"Blogid: {allBlog.Id} \nBlogName: {allBlog.Name}\nPostCount: {allBlog.Posts.Count()}\nPostId: {allBlog.Posts.ElementAt(0).Id}\nPostName: {allBlog.Posts.ElementAt(0).Content}"); } var input = Console.ReadLine(); }
public StudentController(IStudentService studentService, SWDContext context, IMapper mapper) { _context = context; _service = studentService; _mapper = mapper; }
public StudentService(SWDContext context) : base(context) { }
public CompanyService(SWDContext context) : base(context) { }
public JobsController(SWDContext context, IJobService service, IMapper mapper) { _context = context; _service = service; _mapper = mapper; }
public JobService(SWDContext context) : base(context) { }
public BaseService(SWDContext context) { _context = context; _dbset = _context.Set <TEntity>(); }