public async Task <IActionResult> DeleteHistory(Guid id, string returnUrl = null) { var project = await ProjectService.GetCurrentProjectSettings(); if (project == null) { Log.LogError("project settings not found"); return(RedirectToAction("Index")); } var hx = await HistoryQueries.Fetch(project.Id, id).ConfigureAwait(false); if (hx != null) { switch (hx.ContentSource) { case ContentSource.Blog: var canEditPosts = await User.CanEditPages(project.Id, AuthorizationService); if (canEditPosts) { await HistoryCommands.Delete(project.Id, id).ConfigureAwait(false); } break; case ContentSource.Page: var canEditPages = await User.CanEditPages(project.Id, AuthorizationService); if (canEditPages) { await HistoryCommands.Delete(project.Id, id).ConfigureAwait(false); } break; } } if (!string.IsNullOrEmpty(returnUrl)) { return(LocalRedirect(returnUrl)); } return(RedirectToAction("Index")); }
public virtual async Task <IActionResult> Index( CancellationToken cancellationToken, int pageNumber = 1, int pageSize = 10, int sortMode = 0, string contentSource = null, string editor = null ) { var project = await ProjectService.GetCurrentProjectSettings(); if (project == null) { Log.LogError("project settings not found returning 404"); return(NotFound()); } var model = new ContentHistoryViewModel() { History = await HistoryQueries.GetList( project.Id, contentSource, editor, pageNumber, pageSize, sortMode, cancellationToken), ContentSource = contentSource, Editor = editor, SortMode = sortMode, CanEditPages = await User.CanEditPages(project.Id, AuthorizationService), CanEditPosts = await User.CanEditBlog(project.Id, AuthorizationService) }; return(View(model)); }
// GET: History public ActionResult Index() { List <History> model = HistoryQueries.GetHistoryByUser(UserQueries.GetCurrentUsername()); return(View(model)); }
public void Insert(HistoryQueries.Insert value) { Action<string> yield = x => Console.WriteLine("History.Insert " + x); var sql = @" insert into History1 (query, context) values ( ? /* text */, ? /* context */ ) "; var m = new mysqli( "localhost", "root", "" ); m.query("use `datasource1001`"); yield("before prepare"); (m.prepare(sql) as mysqli_stmt).With( stmt => { yield("in prepare"); { var message = new { stmt.errno, stmt.error }; yield(message.ToString()); } // <b>Strict Standards</b>: Only variables should be passed by reference // errno = 1136, error = Column count doesn't match value count at row 1 //var arg1 = value.query; //stmt.bind_param("s", arg1); //var arg2 = value.context; //stmt.bind_param("s", arg2); yield("bind_param_array"); stmt.bind_param_array("ss", value.query, value.context ); stmt.execute(); { var message = new { stmt = new { stmt.errno, stmt.error, stmt.insert_id }, m.insert_id, sql }; yield(message.ToString()); } stmt.close(); } ); yield("after prepare"); { var message = new { m.errno, m.error, sql }; yield(message.ToString()); } }