public ActionResult Delete(int id, Category category) { try { Repository.DeleteCategory(id); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Category category) { try { Repository.NewCategory(category); return RedirectToAction("Index"); } catch { return View(); } }
/// <summary> /// Write a new log entry with the specified category and priority. /// </summary> /// <param name="message">Message body to log.</param> /// <param name="category">Category of the entry.</param> /// <param name="priority">The priority of the entry.</param> public void Log(string message, Category category, Priority priority) { if (this.Callback != null) { this.Callback(message, category, priority); } else { savedLogs.Enqueue(new Tuple<string, Category, Priority>(message, category, priority)); } }
public ActionResult Edit(int id, Category category) { try { category.Id = id; Repository.UpdateCategory(category); return RedirectToAction("Index"); } catch { return View(); } }
private void Log(String message, Category category, Priority priority) { this.LogContainer.Text += String.Format(CultureInfo.CurrentUICulture, "[{0}][{1}] {2}\r\n", category, priority, message); // 这段代码的作用是让文本框的滚动条滚动到最底部 this.LogContainer.ScrollToEnd(); }