public int CompareTo(object obj) { MessagesViewModel message = obj as MessagesViewModel; if (message != null) { return(this.CreatedDate.CompareTo(message.CreatedDate)); } else { throw new Exception("Невозможно сравнить два объекта"); } }
public ActionResult Index() { var messages = App.Messages; if (Request.IsAjaxRequest()) { return Json(messages, JsonRequestBehavior.AllowGet); } var viewModel = new MessagesViewModel(messages); return View(viewModel); }