/// <summary> /// Updates a ticket's flag color /// </summary> /// <param name="ticketID">The id of the ticket</param> /// <param name="newFlagColor">The new flag color to use</param> /// <returns>Whether the flag color succesfully changed or not</returns> public async Task <bool> UpdateTicketFlagColorAsync(long ticketID, Constants.TicketFlagColors newFlagColor) { // Make sure the ticket exists first bool ticketExists = await ticketDAO.CheckTicketExistenceAsync(ticketID); if (!ticketExists) { throw new ArgumentException(Constants.TicketUpdateNotExists); } // Update the ticket TicketRecord ticketRecord = new TicketRecord(ticketID, null, null, newFlagColor.ToString(), null); await ticketDAO.UpdateAsync(ticketRecord); return(true); }
/// <summary> /// Updates a ticket's flag color /// </summary> /// <param name="ticketID">The id of the ticket to update</param> /// <param name="newFlagColor">The new flag color to replace</param> /// <param name="jwtToken">Authorization token</param> /// <returns>Success status</returns> public async Task <Result <bool> > UpdateTicketFlagColorAsync(long ticketID, Constants.TicketFlagColors newFlagColor, string jwtToken) { Result <bool> result; try { AuthorizeUser(Constants.Operations.UpdateTicket, ref jwtToken); await ticketService.UpdateTicketFlagColorAsync(ticketID, newFlagColor); result = new Result <bool>(Constants.TicketManagerSuccessUpdateFlagColor); } catch { // Save error result = new Result <bool>(Constants.TicketManagerFailedUpdateFlagColor) { ExceptionOccurred = true }; } return(result); }