or
@(Html.Kendo().Chart() .Name("KendoChart") .Title("Sample Chart") .ChartArea(chart => {chart.Width(600).Border(1, "#000", ChartDashType.Solid);}) .HtmlAttributes(new { style = "width:600px;height:400px;float:left;margin:2px" }) .Series(s => { s.Line(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }); }) .Tooltip(tip => tip.Visible(true)) .YAxis(y => { y.Numeric().Min(0).Max(3000).MajorUnit(100).PlotBands(bands => { bands.Add().From(0).To(3).Color("yellow").Opacity(0.3); bands.Add().From(3).To(6).Color("orange").Opacity(0.3); bands.Add().From(6).To(9).Color("red").Opacity(0.3); }); }) .Legend(legend => legend.Visible(true).Position(ChartLegendPosition.Bottom)) )01.@(Html.Kendo().Grid(Model.ReceiptDocumentsList).Name("list")02. .Columns(columns =>03. {04. columns.Bound(c => c.DocumentName);05. columns.Bound(c => c.Title);06. columns.Bound(c => c.Userid);07. columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);08. })09. .ToolBar(toolbar => toolbar.Create())10. .Editable(editable => editable.Mode(GridEditMode.PopUp))11. .Pageable()12. .Sortable()13. .Scrollable()14. .DataSource(ds => ds15. .Ajax()16. .PageSize(20)17. .Events(events => events.Error("error_handler"))18. .Model(model => {19. model.Id(r => r.Id);20. })21. .Read(read => read.Url("/api/receiptdocuments").Type(HttpVerbs.Get))22. .Update(update => update.Url("/api/receiptdocuments/put").Type(HttpVerbs.Put))23. .Create(create => create.Url("/api/receiptdocuments/post").Type(HttpVerbs.Post))24. .Destroy(destroy => destroy.Url("/api/receiptdocuments/delete").Type(HttpVerbs.Delete))25. )26.)27. 28. 29.<script type="text/javascript">30. function error_handler(e) {31. if (e.errors) {32. var message = "Errors:\n";33. $.each(e.errors, function (key, value) {34. if ('errors' in value) {35. $.each(value.errors, function () {36. message += this + "\n";37. });38. }39. });40. alert(message);41. }42. }43.</script>01.public class ReceiptDocumentsController : BaseController<ReceiptDocuments>02.{03. #region ctors04. 05. private readonly IReceiptDocumentsService _receiptDocumentsService;06. 07. private readonly IUnitOfWork _unitOfWork;08. 09. public ReceiptDocumentsController(IReceiptDocumentsService receiptDocumentsService, IUnitOfWork unitOfWork) : base(receiptDocumentsService, unitOfWork)10. {11. this._receiptDocumentsService = receiptDocumentsService;12. this._unitOfWork = unitOfWork;13. }14. 15. #endregion16. 17.}001./// <summary>002./// This is the common base ApiController used for all controllers.003./// This class handles all the basic CRUD operations for the WebApi functions.004./// </summary>005./// <typeparam name="T"></typeparam>006.public class BaseController<T> : ApiController where T : Entity007.{008. #region ctors009. protected readonly IService<T> _service;010. 011. private readonly IUnitOfWork _unitOfWork;012. 013. public BaseController(IService<T> service, IUnitOfWork unitOfWork)014. {015. this._service = service;016. this._unitOfWork = unitOfWork;017. }018. 019. #endregion020. 021. #region Basic CRUD022. 023. /// <summary>024. /// Get all the Products in the repository.025. /// </summary>026. /// <returns></returns>027. public IEnumerable<T> Get()028. {029. return _service.Get();030. }031. 032. /// <summary>033. /// Get the selected Product.034. /// </summary>035. /// <param name="id">Id</param>036. /// <returns></returns>037. public T Get(int id)038. {039. T model = _service.GetById(id);040. if (model == null)041. throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));042. 043. return model;044. }045. 046. /// <summary>047. /// Insert a new Product into the repository.048. /// </summary>049. /// <param name="model">Product</param>050. /// <returns></returns>051. public HttpResponseMessage Post(T model)052. {053. if (ModelState.IsValid)054. {055. _service.Insert(model);056. _unitOfWork.Commit();057. 058. var response = Request.CreateResponse(HttpStatusCode.Created, model);059. response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = model.Id }));060. 061. return response;062. }063. else064. {065. throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest));066. }067. }068. 069. /// <summary>070. /// Update the selected Product.071. /// </summary>072. /// <param name="id">Id</param>073. /// <param name="model">Product</param>074. /// <returns></returns>075. public HttpResponseMessage Put(T model)076. {077. if (ModelState.IsValid)078. {079. try080. {081. _service.Update(model);082. _unitOfWork.Commit();083. }084. catch (Exception)085. {086. return Request.CreateResponse(HttpStatusCode.NotFound);087. }088. return Request.CreateResponse(HttpStatusCode.OK, model);089. }090. else091. {092. return Request.CreateResponse(HttpStatusCode.BadRequest);093. }094. }095. 096. /// <summary>097. /// Delete the selected Product.098. /// </summary>099. /// <param name="id">Id</param>100. /// <returns></returns>101. public HttpResponseMessage Delete(int id)102. {103. T model = _service.GetById(id);104. if (model == null)105. {106. return Request.CreateResponse(HttpStatusCode.NotFound);107. }108. 109. try110. {111. _service.Delete(model);112. _unitOfWork.Commit();113. }114. catch (Exception)115. {116. return Request.CreateResponse(HttpStatusCode.NotFound);117. }118. 119. return Request.CreateResponse(HttpStatusCode.OK, model);120. }121. #endregion122. 123.}01.public static class WebApiConfig02.{03. public static void Register(HttpConfiguration config)04. {05. config.Routes.MapHttpRoute(name: "ReceiptDocuments",06. routeTemplate: "api/receiptdocuments/{action}/{id}",07. defaults: new { controller = "ReceiptDocuments", action = "Get", id = RouteParameter.Optional });08. 09. 10. config.Routes.MapHttpRoute(11. name: "DefaultApi",12. routeTemplate: "api/{controller}/{id}",13. defaults: new { id = RouteParameter.Optional }14. );15. }16.}1.{"Message":"No HTTP resource was found that matches the request URI 'http://localhost:59723/api/receiptdocuments/delete'.","MessageDetail":"No action was found on the controller 'ReceiptDocuments' that matches the request."}public ActionResult Schedule(){ var now = DateTime.Now; ViewBag.StartTime = new DateTime(now.Year, now.Month, now.Day, 7, 0, 0, DateTimeKind.Local); ViewBag.TimeZone = "Etc/UTC"; return View();}@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>() .Name("scheduler") .Date(DateTime.Now) .StartTime((DateTime)ViewBag.StartTime) .Timezone((string)ViewBag.TimeZone) .AllDaySlot(false) .Editable(e => { e.Create(true); e.Destroy(true); e.Update(true); }) .Height(590) .Views(views => { views.DayView(); views.WeekView(v => v.Selected(true)); views.MonthView(); views.AgendaView(); }) .DataSource(d => d .Model(m => { m.Id(f => f.TaskID); m.Field(f => f.TaskID); m.Field(f => f.Title); m.Field(f => f.ProviderId); m.Field(f => f.Start); m.Field(f => f.StartTimezone); m.Field(f => f.EndTimezone); m.Field(f => f.Description); m.Field(f => f.RecurrenceID); m.Field(f => f.RecurrenceRule); m.Field(f => f.RecurrenceException); m.Field(f => f.OwnerID); m.Field(f => f.IsAllDay); }) .Read(read => read.Action("Read", "Scheduler").Data("additionalData")) .Create(create => create.Action("Create", "Scheduler").Data("additionalData")) .Update(update => update.Action("Update", "Scheduler")) .Destroy(destroy => destroy.Action("Destroy", "Scheduler")) .ServerOperation(true) ))@(Html.Kendo().Scheduler<Kendo.Mvc.Examples.Models.Scheduler.TaskViewModel>() .Name("scheduler") .Date(DateTime.Now) .StartTime((DateTime)ViewBag.StartTime) .Timezone((string)ViewBag.TimeZone) .AllDaySlot(false) .Editable(e => { e.Create(true); e.Destroy(true); e.Update(true); }) .Height(590) .Views(views => { views.DayView(); views.WeekView(v => v.Selected(true)); views.MonthView(); views.AgendaView(); }) .DataSource(d => d .Model(m => { m.Id(f => f.TaskID); m.Field(f => f.TaskID); m.Field(f => f.Title); m.Field(f => f.ProviderId); m.Field(f => f.Start); m.Field(f => f.StartTimezone); m.Field(f => f.EndTimezone); m.Field(f => f.Description); m.Field(f => f.RecurrenceID); m.Field(f => f.RecurrenceRule); m.Field(f => f.RecurrenceException); m.Field(f => f.OwnerID); m.Field(f => f.IsAllDay); }) .Read(read => read.Action("Read", "Scheduler").Data("additionalData")) .Create(create => create.Action("Create", "Scheduler").Data("additionalData")) .Update(update => update.Action("Update", "Scheduler")) .Destroy(destroy => destroy.Action("Destroy", "Scheduler")) .ServerOperation(true) ))public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, TaskViewModel task, int? providerId){ ... return Json(new[] { task }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet);}