This is a migrated thread and some comments may be shown as answers.

Create event Fire 4 times

1 Answer 65 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Abdalla
Top achievements
Rank 1
Abdalla asked on 11 May 2017, 04:36 PM

I have Problem with UI schedule.when I try to enter new Meeting to the room the create event will fire 4 times 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using TelerikScheduler.Entities;
using TelerikScheduler.Services;
using TelerikScheduler.ViewModels;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
 
 
namespace TelerikScheduler.Controllers
{
    public class HomeController : Controller
    {
        private IMeetingData meetingData;
 
        public HomeController(IMeetingData meetingData)
        {
            this.meetingData = meetingData;
        }
 
        public IActionResult Index()
        {
            var model = new HomePageViewModel();
            model.Rooms = meetingData.GetAll();
 
 
            return View(model);
        }
 
        public virtual JsonResult ReadMeeting([DataSourceRequest] DataSourceRequest request)
        {
            return Json(meetingData.GetAll().ToDataSourceResult(request));
        }
 
        public virtual JsonResult DestroyMeeting([DataSourceRequest] DataSourceRequest request, Meeting meeting)
        {
            if (ModelState.IsValid)
            {
               // meetingData.Delete(meeting);
            }
            return Json(new[] { meeting }.ToDataSourceResult(request, ModelState));
        }
 
        public virtual JsonResult CreateMeeting([DataSourceRequest] DataSourceRequest request, Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                meetingData.Insert(meeting, ModelState);
 
            }
            return Json(new[] { meeting }.ToDataSourceResult(request, ModelState));
        }
 
        public virtual JsonResult UpdateMeeting([DataSourceRequest] DataSourceRequest request, Meeting meeting)
        {
            if (ModelState.IsValid)
            {
                //meetingData.Update(meeting);
            }
            return Json(new[] { meeting }.ToDataSourceResult(request, ModelState));
        }
 
 
        public IActionResult Error()
        {
            return View();
        }
    }
}
@using TelerikScheduler.Entities
@using Kendo.Mvc.UI
@using Microsoft.AspNetCore.Mvc.ModelBinding
@model TelerikScheduler.ViewModels.HomePageViewModel
<head>
    <title>Home</title>
</head>
<body>
    <h1>Welcome!</h1>
 
@(Html.Kendo().Scheduler<Meeting>().Name("Meeting").Date(new DateTime(2017, 5, 13))
      .StartTime(new DateTime(2017, 5,13, 7, 00, 00))
      .Views(views=>{
          views.DayView();
          views.AgendaView();
      })
      .Height(600)
      .Timezone("Etc/UTC")
      .Group(group => { group.Resources("Rooms"); group.Date(true); })
      .Resources(resource =>
      {
          resource.Add(m => m.RoomId).Title("Room").Name("Rooms").DataTextField("Text").DataValueField("Value").DataColorField("Color").BindTo(new[] {
              new { Text = "Meeting Room 101", Value = 1, Color = "#6eb3fa" },
              new { Text = "Meeting Room 201", Value = 2, Color = "#f58a8a" }
          });
          resource.Add(m => m.Attendees)
              .Title("Attendees")
              .Multiple(true)
              .DataTextField("Text")
              .DataValueField("Value")
              .DataColorField("Color")
              .BindTo(new[] {
                  new { Text = "Alex", Value = 1, Color = "#f8a398" } ,
                  new { Text = "Bob", Value = 2, Color = "#51a0ed" } ,
                  new { Text = "Charlie", Value = 3, Color = "#56ca85" }
              });
      }).DataSource(d => d
          .Model(m =>
          {
              m.Id(f => f.RecordId);
              m.Field(f => f.Title).DefaultValue("No title");
              m.Field(f => f.Title).DefaultValue("No title");
          })
          .Read("ReadMeeting", "Home")
          .Create("CreateMeeting", "Home")
          .Destroy("DestroyMeeting", "Home")
          .Update("UpdateMeeting", "Home")
          ).BindTo(Model.Rooms).Deferred())
 
 
@section scripts {
    @Html.Kendo().DeferredScripts()
}
 
 
 
</body>
</html>

 

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 May 2017, 02:28 PM
Hello Abdalla,

I am afraid I was not able to replicate the described issue.

In the attached file (TelerikAspNetCoreAppScheduler.zip) you will find a basic setup for the Kendo Scheduler in ASP.NET Core, which I managed to setup by following the provided code sample. You can find the HTML markup in Views/Home/Index.cshtml and the Read and Create actions in Controllers/HomeController.cs.

​May I ask you to modify the above example, so that it reproduces the issue faced and send it back to us? This way I will be able to troubleshoot the problem and provide you with the most appropriate assistance for the case. 

I am looking forward to hearing from you.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Abdalla
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or