/// <summary> /// Create a StudentCohortAssociation object /// </summary> /// <param name="cs">the service to use for this action</param> /// <param name="associations">the StudentCohortAssociation to create</param> /// <returns>result of this action</returns> public static async Task<ActionResponseResult> CreateOneStudentCohortAssociation(CohortService cs, string cId, string sId) { var a = new StudentCohortAssociation { cohortId = cId, studentId = sId, beginDate = DateTime.Now }; var result = await cs.CreateStudentCohortAssociation(a); var student = (StudentDisplayObject)HttpContext.Current.Cache[sId]; return GlobalHelper.GetActionResponseResult(sId, student != null ? student.name : "", result, HttpStatusCode.Created); }
/// <summary> /// Delete a StudentCohortAssociation object /// </summary> /// <param name="cs">service to use for this action</param> /// <param name="association">the StudentCohortAssociation to delete</param> /// <returns>result of this action</returns> public static async Task<ActionResponseResult> DeleteOneStudentCohortAssociation(CohortService cs, StudentCohortAssociation association) { var response = await cs.DeleteStudentCohortAssociationById(association.id); var student = (StudentDisplayObject)HttpContext.Current.Cache[association.studentId]; return GlobalHelper.GetActionResponseResult(association.studentId, student != null ? student.name : "", response, HttpStatusCode.NoContent); }