You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
I am using json to save data and fetch data. when i logout from the page, the session should be clear and when i press back button of the browser, and perform any event it should redirect me back to login page, but instead save feature is working when i press back button but when i refresh it redirects me to login page. This should happen without me refreshing the page
Controller:
`public ActionResult Index()
{
return View();
}
public ActionResult Logout()
{
Session.Clear();
Session.Abandon();
return RedirectToAction("Index2", "Login");
}
public JsonResult GetEvents(string username)
{
//var status = false;
using (MeetingEntities db = new MeetingEntities())
{
var events = db.MeetingDetails.Where(a => a.User_name == username).ToList();
return new JsonResult { Data = events, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}
}
[HttpPost]
public JsonResult SaveEvent(MeetingDetail Ms)
{
var status = false;
using (MeetingEntities db = new MeetingEntities())
{
if (Ms.MeetingId > 0)
{
var v = db.MeetingDetails.Where(a => a.MeetingId == Ms.MeetingId).FirstOrDefault();
if (v != null)
{
v.User_name = Ms.User_name;
v.Subject = Ms.Subject;
v.Start = Ms.Start;
v.End = Ms.End;
v.Description = Ms.Description;
v.IsfullDay = Ms.IsfullDay;
v.ThemeColor = Ms.ThemeColor;
}
}
else
{
db.MeetingDetails.Add(Ms);
}
db.SaveChanges();
status = true;
}
return new JsonResult { Data = new { status = status } };
//var username = Session["UserID"].ToString();
}
public JsonResult deleteEvent(int eventID)
{
var status = false;
{
using (MeetingEntities db=new MeetingEntities())
{
var v = db.MeetingDetails.Where(a => a.MeetingId == eventID).FirstOrDefault();
if (v != null)
{
db.MeetingDetails.Remove(v);
db.SaveChanges();
status = true;
}
}
}
return new JsonResult { Data = new { status = status } };
}
}`
I am using json to save data and fetch data. when i logout from the page, the session should be clear and when i press back button of the browser, and perform any event it should redirect me back to login page, but instead save feature is working when i press back button but when i refresh it redirects me to login page. This should happen without me refreshing the page
Controller:
`public ActionResult Index()
{
View:
$(document).ready(function () {
$('#btnSave').click(function () {$('#chkisfullday').is(':checked') == false && $ ('#txtend').val().trim() == "") {
alert(username);
if ($('#txtsubject').val().trim() == "") {
alert('Subject required');
return;
}
if ($('#txtstart').val().trim() == "") {
alert('Start Date required');
return;
}
if ($('#txtsubject').val().trim() == "") {
alert('Subject required');
return;
}
if (
alert('End Date required');
return;
}
else {
var startDate = moment($('#txtstart').val(), "DD/MM/YYYY HH:mm A").toDate();
var endDate = moment($('#txtend').val(), "DD/MM/YYYY HH:mm A").toDate();
if (startDate > endDate) {
alert('Invalid end date');
return;
}
}
The text was updated successfully, but these errors were encountered: