public async Task <IActionResult> CreateTicket([FromBody] SupportChangeStatus status, string ticketId) { var steamId = User.GetSteamId(); if (!ModelState.IsValid) { return(BadRequest(status)); } if (!Enum.TryParse(status.Status, true, out TicketStatus ticketStatus)) { return(BadRequest($"Status {status.Status} is not a valid status")); } var res = await _ticketService.AdminChangeStatusOnTicket(new AdminChangeStatusOnTicketRequest { Status = ticketStatus, TicketId = ticketId }); if (res.DataCase == SingleTicketResponse.DataOneofCase.Error) { return(new ObjectResult(res.Error) { StatusCode = 503 }); } return(Ok()); }
public async Task <dynamic> CreateTicket([FromBody] SupportCreateModel ticket) { var steamId = User.GetSteamId(); if (!ModelState.IsValid) { return(BadRequest(ticket)); } var res = await _ticketService.AdminCreateTicket(new AdminCreateTicketRequest { Message = new InputMessage { MessageBody = ticket.Message, Name = ticket.Name }, SteamId = ticket.SteamId, Title = ticket.Title }); if (res.DataCase == SingleTicketResponse.DataOneofCase.Error) { return(new ObjectResult(res.Error) { StatusCode = 503 }); } return(Ok(res)); }
public async Task <IActionResult> SendItemsToPlayer([FromBody] TransferItemsModel model) { var currentUser = await _userService.FindAsync(User.GetSteamId()); if (await _itemTransferService.TransferItemsAsync(currentUser, model.ToSteamId, model.Items)) { return(Ok()); } return(BadRequest("Could not process request, please check input")); }