public async Task <IActionResult> Reset(int id)//重置某个学生提交数据 { if (judge()) { var student = await studentBll.GetEntities(n => n.id == id).FirstOrDefaultAsync(); student.time = ""; student.sub = 0; studentBll.Update(student); return(Content("<script>alert('重置该学生成功');window.location.href='/Home/Index';</script>", "text/html", System.Text.Encoding.UTF8)); } return(non()); }
public async Task <IActionResult> Index(string name, string myimg) { var stu = await studentBll.GetEntities(u => u.name == name).FirstOrDefaultAsync(); if (myimg == null) { return(Content("<script>alert('图片未提交!');window.location.href='../Home/Index';</script>", "text/html", System.Text.Encoding.UTF8)); } if (stu != null) { string diffImg = "安心睡吧!"; stu.sub = 1; stu.time = DateTime.Now.ToString(); Common.SaveImage.ByStringToSave(name, myimg); if (System.IO.File.Exists("./wwwroot/StudentImage/陈淳.jpg")) { if (Common.SaveImage.Compare("./wwwroot/StudentImage/" + name + ".jpg", "./wwwroot/StudentImage/陈淳.jpg") > 20) { diffImg = "但是与标准图片相差过大,请检查你的图片"; } } studentBll.Update(stu); return(Content("<script>alert('提交成功!" + diffImg + "');window.location.href='../Home/Index';</script>", "text/html", System.Text.Encoding.UTF8)); } else { return(Content("<script>alert('你确定是本班的?');window.location.href='../Home/Index';</script>", "text/html", System.Text.Encoding.UTF8)); } }