public async Task <ActionResult> Edit([Bind(Include = "StudentId,CardNumber,StudentName,Sex,NationId,Birthday,CNumber,NativePlace,TelNumber,SchoolName,Adress,ZipCode,Patriarch,Pat_Telnum,Mandator,UnifiedScore,TotalPoints,SpecialtyId,Period_CategoryId,StudentAccId")] Student student)
        {
            if (ModelState.IsValid)
            {
                int id = student.StudentId;
                student.Time            = DateTime.Now;
                db.Entry(student).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(Redirect("~/Student/Details/" + id + ""));
            }
            else
            {
                string  myacc  = Session["Acc"].ToString();
                Student MyInfo = await db.Students.Where(s => s.StudentAcc.StuAcc == myacc).FirstOrDefaultAsync();

                //专业学制类型编号=学制名称编号
                int categoryid = MyInfo.Period_CategoryId;

                //学制名称
                ViewBag.CategoryName = db.Period_Categorys.Find(categoryid).CategoryName;
                //ViewBag.StudentAccId = new SelectList(db.StudentAccs, "StudentAccId", "StuAcc", student.StudentAccId);
                //56个名族
                ViewBag.NationId = new SelectList(db.Nations, "NationId", "NationName", student.NationId);
                //所在学制的专业列表
                ViewBag.SpecialtyId = new SelectList(db.Specialtys.Where(s => s.Period_CategoryId == categoryid), "SpecialtyId", "SpecialtyName");
            }

            return(View(student));
        }
        public async Task <ActionResult> Edit([Bind(Include = "StudentAccId,StuAcc,Password")] StudentAcc studentAcc)
        {
            if (ModelState.IsValid)
            {
                db.Entry(studentAcc).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(studentAcc));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,AdminName,Password")] SysAdmin sysAdmin)
        {
            if (ModelState.IsValid)
            {
                db.Entry(sysAdmin).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(sysAdmin));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Edit([Bind(Include = "SpecialtyId,SpecialtyName,Period_CategoryId,Tuition")] Specialty specialty)
        {
            if (ModelState.IsValid)
            {
                db.Entry(specialty).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Period_CategoryId = new SelectList(db.Period_Categorys, "Period_CategoryId", "CategoryName", specialty.Period_CategoryId);
            return(View(specialty));
        }