public ActionResult <Event> UpdateEvent([FromBody] Event e) { IAuthService authService = new JWTService(clientSettings.Value.SecretKey); string token = HttpContext.Request.Headers["Authorization"]; try { if (!authService.IsTokenValid(token)) { return(BadRequest("Unauthorized Access")); } else { if (eventProcessor.HasEventChangedRowVersion(e.EventID, e.RowId)) { Event emptyEvent = new Event(); return(emptyEvent); } if (eventProcessor.UpdateEvent(e.EventID, e.Name, e.EventType, e.Location, e.Date, e.Description, e.MaxNumberOfCharacters, e.GuildID, e.RowId)) { return(e); } return(BadRequest("Invalid data")); } } catch { return(BadRequest("Unauthorized Access")); } }