/// <summary> /// Delete a cohort /// </summary> /// <param name="id">the id of the cohort to delete</param> public static async Task<Result> DeleteCohort(CohortService cs, string id) { try { var result = new Result { completedSuccessfully = false }; //default to false, set to true later if it's successful var response = await cs.DeleteById(id); if (response.StatusCode == HttpStatusCode.NoContent) result.completedSuccessfully = true; return result; } catch { throw; } }
public void DeleteCohort(string id) { try { var c = new CohortService(Session["access_token"].ToString()); var result = c.DeleteById(id); //return result; Response.Redirect(MAIN); } catch { throw; } //throw new Exception("break here"); }
/// <summary> /// Delete a cohort /// </summary> /// <param name="id">the id of the cohort to delete</param> public static async Task<Result> DeleteCohort(CohortService cs, string id) { try { var result = new Result { completedSuccessfully = false }; //default to false, set to true later if it's successful var response = await cs.DeleteById(id); if (response.StatusCode == HttpStatusCode.NoContent) { result.completedSuccessfully = true; } else if (response.StatusCode == HttpStatusCode.Forbidden) { result.objectActionResult = new ActionResponseResult(); result.objectActionResult.status = HttpStatusCode.Forbidden; result.objectActionResult.message = "{\"type\":\"Forbidden\",\"message\":\"Access DENIED: Insufficient Privileges\",\"code\":403}"; } return result; } catch { throw; } }