TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
473k
Timeshechelor not saving to the database record
Sep 30 2020 8:13 AM
Hi Team
My time schedulor is not saving to the database record, its only creating the events only when a user creates them. Need some help as to why, even if i refresh the browser those events are not being saved.
public
ActionResult eNtsaCourseEvents()
{
RegCoursesViewModel regCourses =
new
RegCoursesViewModel();
var sched =
new
DHXScheduler(
this
);
sched.Skin = DHXScheduler.Skins.Terrace;
sched.LoadData =
true
;
sched.EnableDataprocessor =
true
;
sched.InitialDate =
new
DateTime(2020, 09, 17);
return
View(sched);
}
//GET:Data-Calendar.
public
ContentResult eNtsaData()
{
return
(
new
SchedulerAjaxData(
new
eNtsaRegistration_2().Events
.Select(e =>
new
{ e.id, e.text, e.start_date, e.end_date })
)
);
}
// Save-Data-Events.
public
ContentResult eNtsaSaveEvents(
int
? id, FormCollection actionValues)
{
var action =
new
DataAction(actionValues);
var changedEvent = DHXEventsHelper.Bind<eNtsaCalendarEvents>(actionValues);
var entities =
new
eNtsaRegistration_2();
try
{
switch
(action.Type)
{
case
DataActionTypes.Insert:
entities.Events.Add(changedEvent);
break
;
case
DataActionTypes.Delete:
changedEvent = entities.Events.FirstOrDefault(ev => ev.id == action.SourceId);
entities.Events.Remove(changedEvent);
break
;
default
:
// "update"
var target = entities.Events.Single(e => e.id == changedEvent.id);
DHXEventsHelper.Update(target, changedEvent,
new
List<
string
> {
"id"
});
break
;
}
entities.SaveChanges();
action.TargetId = changedEvent.id;
}
catch
(Exception e)
{
action.Type = DataActionTypes.Error;
}
return
(
new
AjaxSaveResponse(action));
}
Reply
Answers (
4
)
Jquery online and offline
How to run jquery function on bootstrap modal popup button click