public async Task <ActionResult> Create(AffectiveViewModel model) { if (ModelState.IsValid) { Affective affective = new Affective() { StudentId = model.StudentId, TermName = model.TermName, SessionName = model.SessionName, ClassName = model.ClassName, Honesty = model.Honesty.ToString(), SelfConfidence = model.SelfConfidence.ToString(), Sociability = model.Sociability.ToString(), Punctuality = model.Punctuality.ToString(), Neatness = model.Neatness.ToString(), Initiative = model.Initiative.ToString(), Organization = model.Organization.ToString(), AttendanceInClass = model.AttendanceInClass.ToString(), HonestyAndReliability = model.HonestyAndReliability.ToString(), SchoolId = userSchool }; Db.Affectives.Add(affective); await Db.SaveChangesAsync(); return(RedirectToAction("FormTeacher", "Classes")); } return(View(model)); }
public async Task <ActionResult> DeleteConfirmed(int id) { Affective affective = await Db.Affectives.FindAsync(id); if (affective != null) { Db.Affectives.Remove(affective); } await Db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,StudentId,TermName,SessionName,ClassName,Honesty,SelfConfidence,Sociability,Punctuality,Neatness,Initiative,Organization,AttendanceInClass,HonestyAndReliability")] Affective affective) { if (ModelState.IsValid) { affective.SchoolId = userSchool; Db.Entry(affective).State = EntityState.Modified; await Db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(affective)); }
// GET: Affectives/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Affective affective = await Db.Affectives.FindAsync(id); if (affective == null) { return(HttpNotFound()); } return(View(affective)); }