public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] Role role) { if (ModelState.IsValid) { db.Entry(role).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(role)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Address")] School school) { if (ModelState.IsValid) { db.Entry(school).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(school)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Login,Password,Name,Surname,RoleId")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.RoleId = new SelectList(db.Roles, "Id", "Name", user.RoleId); return(View(user)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Login,Password,Name,Surname,PhoneNumber")] Teacher teacher) { if (!isAuthenticate()) { return(Redirect("/Admin/LoginPage/?error")); } if (ModelState.IsValid) { db.Entry(teacher).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(teacher)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Value,SchoolKidId,SubjectId,Date")] Grade grade) { if (!isAuthenticate()) { return(Redirect("/Admin/LoginPage/?error")); } if (ModelState.IsValid) { db.Entry(grade).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.SchoolKidId = new SelectList(db.SchoolKids, "Id", "Login", grade.SchoolKidId); ViewBag.SubjectId = new SelectList(db.Subjects, "Id", "Name", grade.SubjectId); return(View(grade)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,TeacherId,GroupId")] Subject subject) { if (!isAuthenticate()) { return(Redirect("/Admin/LoginPage/?error")); } if (ModelState.IsValid) { db.Entry(subject).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.GroupId = new SelectList(db.Groups, "Id", "Name", subject.GroupId); ViewBag.TeacherId = new SelectList(db.Teachers, "Id", "PhoneNumber", subject.TeacherId); return(View(subject)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,SchoolId,AdviserId")] Group group) { if (!isAuthenticate()) { return(Redirect("/Admin/LoginPage/?error")); } if (ModelState.IsValid) { db.Entry(group).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.AdviserId = new SelectList(db.Teachers, "Id", "Login", group.AdviserId); ViewBag.SchoolId = new SelectList(db.Schools, "Id", "Name", group.SchoolId); return(View(group)); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Login,Password,Name,Surname,MotherId,FatherId,SchoolId,GroupId")] SchoolKid schoolKid) { if (!isAuthenticate()) { return(Redirect("/Admin/LoginPage/?error")); } if (!IsAdmin()) { return(Redirect("/Admin/LoginPage/?noPermission")); } if (ModelState.IsValid) { db.Entry(schoolKid).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.FatherId = new SelectList(db.Parents, "Id", "Login", schoolKid.FatherId); ViewBag.GroupId = new SelectList(db.Groups, "Id", "Name", schoolKid.GroupId); ViewBag.MotherId = new SelectList(db.Parents, "Id", "Login", schoolKid.MotherId); ViewBag.SchoolId = new SelectList(db.Schools, "Id", "Name", schoolKid.SchoolId); return(View(schoolKid)); }
public void Update(SchoolKid c) { db.Entry(c).State = EntityState.Modified; }