22
This commit is contained in:
		
							parent
							
								
									8d9de377b2
								
							
						
					
					
						commit
						74cb8ff01e
					
				@ -224,10 +224,10 @@ namespace asg_form.Controllers
 | 
				
			|||||||
                var TotalRecords = await query.CountAsync();
 | 
					                var TotalRecords = await query.CountAsync();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var Tasks = await query
 | 
					                var Tasks = await query
 | 
				
			||||||
                    .OrderByDescending(t => t.status == "1" ? 0 :
 | 
					                    .OrderByDescending(t => t.status == "1" ? 3 :
 | 
				
			||||||
                            t.status == "0" ? 1 :
 | 
					                            t.status == "0" ? 2 :
 | 
				
			||||||
                            t.status == "3" ? 2 :
 | 
					                            t.status == "3" ? 1 :
 | 
				
			||||||
                            t.status == "2" ? 3 :
 | 
					                            t.status == "2" ? 0 :
 | 
				
			||||||
                            int.MaxValue)
 | 
					                            int.MaxValue)
 | 
				
			||||||
                    .Skip((page - 1) * limit)
 | 
					                    .Skip((page - 1) * limit)
 | 
				
			||||||
                    .Take(limit)
 | 
					                    .Take(limit)
 | 
				
			||||||
 | 
				
			|||||||
@ -55,23 +55,25 @@ namespace asg_form.Controllers
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
 | 
					            if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                TestDbContext testDb = new TestDbContext();
 | 
					                
 | 
				
			||||||
                int err = 0;
 | 
					                int err = 0;
 | 
				
			||||||
                try
 | 
					                try
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    TestDbContext testDb = new TestDbContext();
 | 
				
			||||||
                    var form = testDb.Forms.First(x => x.Id == req.formId);
 | 
					                    var form = testDb.Forms.First(x => x.Id == req.formId);
 | 
				
			||||||
                    err = 1;
 | 
					                    err = 1;
 | 
				
			||||||
                    var events = testDb.events.First(x => x.name == req.eventname);
 | 
					                    var events = testDb.events.First(x => x.name == req.eventname);
 | 
				
			||||||
                    err = 2;
 | 
					                    err = 2;
 | 
				
			||||||
                    testDb.Champions.Add(new T_Champion { events = events, form = form ,msg=req.msg});
 | 
					                    testDb.Champions.Add(new T_Champion { events = events, form = form ,msg=req.msg});
 | 
				
			||||||
                    err = 3;
 | 
					                    err = 3;
 | 
				
			||||||
 | 
					                    await testDb.SaveChangesAsync();
 | 
				
			||||||
 | 
					                    return Ok();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                 catch (Exception ex)
 | 
					                 catch (Exception ex)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    return Ok(new { code = 500, message = "服务器错误",detailcode=err, details = ex.Message });
 | 
					                    return Ok(new { code = 500, message = "服务器错误",detailcode=err, details = ex.Message });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                await testDb.SaveChangesAsync();
 | 
					                
 | 
				
			||||||
                return Ok();
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return BadRequest(new error_mb { code = 400, message = "你没有管理员呢~" });
 | 
					            return BadRequest(new error_mb { code = 400, message = "你没有管理员呢~" });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user