public async Task <IActionResult> RemoverGrupo(Guid id)
        {
            try
            {
                var request = new RemoveGroupRequest(id);
                var result  = await _mediator.Send(request, CancellationToken.None);

                return(await ResponseAsync(result));
            }
            catch (System.Exception ex)
            {
                return(NotFound(ex.Message));
            }
        }
示例#2
0
        public override Task <RemoveGroupResponse> RemoveGroup(RemoveGroupRequest request, ServerCallContext context)
        {
            this.Logger.LogInformation($"Operation:{Utils.GetActualAsyncMethodName()} Payload:{Utils.ProtoToJson(request)}");
            var response = new RemoveGroupResponse()
            {
                Status = 0
            };

            try
            {
                UserManager.Instance.RemoveGroup(request.CurrentUser.Name, request.Group.Name);
            }
            catch (Exception e)
            {
                response.Status  = 1;
                response.Message = e.Message;
            }
            return(Task.FromResult(response));
        }
示例#3
0
        public async Task <ActionResult <RemoveGroupResponse> > PostRemoveGroup([FromBody] RemoveGroupRequest removeGroupRequest)
        {
            // Include Panels to cascade delete
            var groupToDelete = await _Context.Groups.Where(x => x.ID == removeGroupRequest.GroupId).Include(x => x.Panels).FirstOrDefaultAsync();

            if (groupToDelete == null)
            {
                return(NotFound(new RemoveGroupResponse {
                    Status = ResponseStatus.Error, Error = "Group to delete not found"
                }));
            }

            _Context.Groups.Remove(groupToDelete);
            await _Context.SaveChangesAsync();

            _logger.LogDebug("Removed Group {Label}", groupToDelete.Label);

            await _ClientHub.Clients.All.SendAsync(ClientMethods.RemoveGroup, groupToDelete);

            return(Ok(new RemoveGroupResponse()));
        }
示例#4
0
        public async Task <bool> RemoveGroupAsync(RemoveGroupRequest request)
        {
            var res = await _timProxy.RemoveGroupAsync(request.GroupId);

            return(true);
        }
示例#5
0
 public Task <bool> RemoveGroup(RemoveGroupRequest request)
 {
     return(_service.RemoveGroupAsync(request));
 }