public async Task <ActionResult> DeleteConfirmed(int id) { TeacherComment teacherComment = await Db.TeacherComments.FindAsync(id); Db.TeacherComments.Remove(teacherComment); await Db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "TeacherCommentId,StudentId,TermName,SessionName,Remark,Date")] TeacherComment teacherComment) { if (ModelState.IsValid) { Db.Entry(teacherComment).State = EntityState.Modified; await Db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(teacherComment)); }
public TeacherComment EditComment(int commentId, int teacherId, string comment) { EnsureIsDistrictAdminOrCurrentTeacher(teacherId); var syId = ServiceLocator.SchoolYearService.GetCurrentSchoolYear().Id; var stiComment = new GradebookCommect { Comment = comment, TeacherId = teacherId, Id = commentId }; ConnectorLocator.SectionCommentConnector.UpdateComment(syId, teacherId, stiComment); return(TeacherComment.Create(stiComment)); }
public static TeacherCommentViewData Create(TeacherComment teacherComment) { return(new TeacherCommentViewData { Comment = teacherComment.Comment, CommentId = teacherComment.CommentId, IsSystem = teacherComment.IsSystem, TeacherId = teacherComment.TeacherId, EditableForTeacher = teacherComment.EditableForTeacher }); }
/// <summary> /// 添加教师评价 /// </summary> /// <param name="entity">业务实体</param> /// <returns></returns> public int CommentAdd(TeacherComment entity) { if (entity.Org_ID < 1) { Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent(); entity.Org_ID = org.Org_ID; } entity.Thc_CrtTime = DateTime.Now; entity.Thc_IP = WeiSha.Common.Request.IP.IPAddress; entity.Thc_Device = WeiSha.Common.Browser.IsMobile ? "Mobi" : "PC"; return(Gateway.Default.Save <TeacherComment>(entity)); }
// GET: TeacherComments/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TeacherComment teacherComment = await Db.TeacherComments.FindAsync(id); if (teacherComment == null) { return(HttpNotFound()); } return(View(teacherComment)); }
public async Task <ActionResult> Create(TeacherComment model) { if (ModelState.IsValid) { TeacherComment comment = new TeacherComment() { StudentId = model.StudentId, TermName = model.TermName, SessionName = model.SessionName, Remark = model.Remark, Date = model.Date.Date }; Db.TeacherComments.Add(comment); await Db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(model)); }
/// <summary> /// 修改教师评价信息 /// </summary> /// <param name="entity">业务实体</param> public void CommentSave(TeacherComment entity) { Gateway.Default.Save <TeacherComment>(entity); }