public IActionResult Delete(string id) { bool result = CodePayload.Delete(id); if (result == true) { return(Ok(new { user = string.Empty, id = id, message = "File deleted successfully." })); } else { return(BadRequest(new { user = string.Empty, id = id, message = "Error deleting file. Try again or contact adminstrator." })); } }
public void TestDeleteCodePayload() { List <CodeResponse> _model = new List <CodeResponse>(); TestCreateCodePayload(); _model = CodePayload.Get(); Assert.NotNull(_model); // bool isDeleted = CodePayload.Delete("HelloCode"); Assert.True(isDeleted); // _model = CodePayload.Get(); Assert.True(_model.Count == 0); }
public IActionResult Delete(string id) { if (InstancePayload.IsInstanceExists(id) && CodePayload.GetById(id).Type == "JUPYTER_NOTEBOOK") { return(BadRequest(new { user = string.Empty, id = id, message = "Error deleting file. Instance of the file is running. Check Assests module" })); } bool result = CodePayload.Delete(id); if (result == true) { return(Ok(new { user = string.Empty, id = id, message = "File deleted successfully." })); } else { return(BadRequest(new { user = string.Empty, id = id, message = "Error deleting file. Try again or contact adminstrator." })); } }