public ActionResult <string> DeleteEvent([FromHeader(Name = "x-eventid")] int eventID, [FromHeader(Name = "x-rowid")] byte[] rowId) { // Get the Event from database, and compare the rowIds // If they are equal, then delete the event // If not return bad response (currently string) 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(eventID, rowId)) { return("Not succesfully deleted"); } else { if (eventProcessor.DeleteEventByID(eventID)) { return("Succesfully deleted"); } else { return("Not succesfully deleted"); } } } } catch { return(BadRequest("Unauthorized Access")); } }