示例#1
0
        public ActionResult DeleteLabel([FromBody] DeleteLabelRequest request)
        {
            var client = GetFavoriteClient();

            client.DeleteFavoriteLabel(request.LabelId);
            return(Json(new { }));
        }
示例#2
0
        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);
            }
        }
示例#3
0
文件: LabelsRL.cs 项目: shiv-N/Fundoo
        /// <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;
            }
        }
示例#4
0
 public ActionResult DeleteLabel([FromBody] DeleteLabelRequest request)
 {
     using (var client = GetMainServiceClient())
     {
         client.DeleteFavoriteLabel(request.LabelId);
         return(Json(new {}));
     }
 }
示例#5
0
        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 }));
            }
        }
示例#6
0
文件: LabelsBL.cs 项目: shiv-N/Fundoo
 /// <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));
 }