Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
        public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory,
                                    ETrackingContext context, RoleManager <ApplicationRole> roleManager)
        {
            app.UseCors(builder =>
                        builder.AllowAnyHeader().AllowAnyOrigin().AllowAnyMethod());

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIdentity();
            app.UseStaticFiles();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            DbInitializer.Initialize(context);
            await InitializeRoles(roleManager);
        }
        public List <tbfollowing> FindUserFollowByPRNumber(string prNumber, string userid)
        {
            try
            {
                using (var db = new ETrackingContext())
                {
                    var items = db.tbfollowings.Where(i => i.userid == userid && i.pr_number == prNumber).ToList();

                    return(items);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <Comment> FindByPrNumber(string prNumber)
        {
            try
            {
                using (var db = new ETrackingContext())
                {
                    var items = db.Comments.Where(i => i.PrNumber == prNumber).ToList();

                    return(items);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <tbfollowing> Add(tbfollowing follow)
        {
            try
            {
                using (var db = new ETrackingContext())
                {
                    follow.lastmodifieddate = DateTime.Now;
                    db.tbfollowings.Add(follow);
                    db.SaveChanges();

                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <tbfollowing> UpdateFlag_follow(string prNumber, string userid, string flag_follow)
        {
            try
            {
                using (var db = new ETrackingContext())
                {
                    db.tbfollowings.Where(i => i.userid == userid && i.pr_number == prNumber).ToList()
                    .ForEach(x => x.flag_follow = flag_follow);
                    db.SaveChanges();

                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public Comment Add(Comment comment)
        {
            try
            {
                using (var db = new ETrackingContext())
                {
                    comment.UpdateDate = DateTime.Now;
                    var data = db.Comments.Add(comment);
                    db.SaveChanges();

                    return(data);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        //private readonly IMapper mapper;

        public MajorRepository(ETrackingContext context)
        {
            this.context = context;
        }
Example #8
0
        //private readonly IMapper mapper;

        public StaffRepository(ETrackingContext context)
        {
            this.context = context;
        }
Example #9
0
        //private readonly IMapper mapper;

        public ProjectRepository(ETrackingContext context)
        {
            this.context = context;
        }
Example #10
0
        //private readonly IMapper mapper;

        public PositionRepository(ETrackingContext context)
        {
            this.context = context;
        }