public async Task <IHttpActionResult> PutCourseTerm(Guid id, CourseTerm courseTerm) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != courseTerm.CourseTermID) { return(BadRequest()); } db.Entry(courseTerm).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseTermExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetCourseTerm(Guid id) { CourseTerm courseTerm = await db.CourseTerms.FindAsync(id); if (courseTerm == null) { return(NotFound()); } return(Ok(courseTerm)); }
public async Task <IHttpActionResult> PostCourseTerm(CourseTerm courseTerm) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CourseTerms.Add(courseTerm); await db.SaveChangesAsync(); return(CreatedAtRoute("CreateCourseTerm", new { id = courseTerm.CourseTermID }, courseTerm)); }
public async Task <IHttpActionResult> DeleteCourseTerm(Guid id) { CourseTerm courseTerm = await db.CourseTerms.FindAsync(id); if (courseTerm == null) { return(NotFound()); } db.CourseTerms.Remove(courseTerm); await db.SaveChangesAsync(); return(Ok(courseTerm)); }
public CourseTermSection(AssessTrackDataRepository repo, CourseTerm ct) { _repo = repo; CourseTerm = ct; CourseTermMember member = repo.GetCourseTermMemberByMembershipID(ct,UserHelpers.GetCurrentUserID()); DisplayGrade = false; if (member.AccessLevel == 1) { Grade = member.GetFormattedGrade(); } else if (DisplayGrade) { Grade = GradeHelpers.GetFormattedGrade(ct.GetAverageGrade()); } else { Grade = ""; } }