コード例 #1
0
ファイル: NodesController.cs プロジェクト: rp3220/Pizza-API
        public async Task <string> DeleteNodeAsync(int id)
        {
            var response = new ListModelResponse <NodeViewModel>();

            var nodeDataModel = false;

            try
            {
                nodeDataModel = await _nodeRepository.DeleteNode(id);

                if (nodeDataModel)
                {
                    // response.Message = String.Format("Record Deleted Successfully");
                    response.Message = Messages.SuccessMsg;
                }
                else
                {
                    //response.Message = String.Format("Record Deletion failed");
                    response.Message = Messages.FailMsg;
                }
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }

            return(response.Message);
        }
コード例 #2
0
        public int DeleteNode(string id)
        {
            logger.LogInformation($"Removing node id={id}");
            var node = nodeRepository.GetNode(id);

            if (node != null)
            {
                eventBus.Publish(new NodeDeletedEvent()
                {
                    CreationDate = clock.UtcNow(), DeletedNode = node
                });
            }
            return(nodeRepository.DeleteNode(id));
        }
コード例 #3
0
 public JsonResult DeleteNode(int id)
 {
     _nodeRepository.DeleteNode(id);
     return(Json(new { success = true, nodeId = id }));
 }