public ActionResult DeleteLabel([FromBody] DeleteLabelRequest request) { var client = GetFavoriteClient(); client.DeleteFavoriteLabel(request.LabelId); return(Json(new { })); }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCILoganalyticsLabel", "Remove")) { return; } DeleteLabelRequest request; try { request = new DeleteLabelRequest { NamespaceName = NamespaceName, LabelName = LabelName, OpcRetryToken = OpcRetryToken, OpcRequestId = OpcRequestId, IfMatch = IfMatch }; response = client.DeleteLabel(request).GetAwaiter().GetResult(); WriteOutput(response); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Deletes the label. /// </summary> /// <param name="model">The model.</param> /// <param name="userId">The user identifier.</param> /// <returns></returns> public async Task <bool> DeleteLabel(DeleteLabelRequest model, int userId) { try { SqlConnection connection = DBConnection(); SqlCommand command = StoreProcedureConnection("spDeleteLabel", connection); command.Parameters.AddWithValue("Id", model.Id); command.Parameters.AddWithValue("UserId", userId); connection.Open(); int result = await command.ExecuteNonQueryAsync(); connection.Close(); if (result != 0) { return(true); } else { return(false); }; } catch (Exception e) { throw e; } }
public ActionResult DeleteLabel([FromBody] DeleteLabelRequest request) { using (var client = GetMainServiceClient()) { client.DeleteFavoriteLabel(request.LabelId); return(Json(new {})); } }
public async Task <IActionResult> DeleteLabel(DeleteLabelRequest model) { var userId = TokenUserId(); if (await labels.DeleteLabel(model, userId)) { string status = "Label deleted"; return(Ok(new { status, userId, model })); } else { string status = "Label did not deleted"; return(BadRequest(new { status, userId, model })); } }
/// <summary> /// Deletes the label. /// </summary> /// <param name="model">The model.</param> /// <param name="userId">The user identifier.</param> /// <returns></returns> public async Task <bool> DeleteLabel(DeleteLabelRequest model, int userId) { return(await labels.DeleteLabel(model, userId)); }