public async Task <IActionResult> OnPostCreateAppAsync() { bool check = SessionHelpers.GetObject <bool>(HttpContext.Session, Constant.IsLoggedIn); u = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails); page = SessionHelpers.GetObject <string>(HttpContext.Session, Constant.RedirectPage); HttpContext.Session.Remove(Constant.RedirectPage); if (check && u.Username == "Chachi") { p.AppPara.Avgtime = AvgTime; p.AppPara.MorinigScheduleBegin = MorningTimeBegins; p.AppPara.MorningScheduleEnds = MorningTimeEnds; p.AppPara.AfternoonScheduleBegins = AfternoonTimeBegins; p.AppPara.AfternoonSCheduleEnds = AfternoonTimeEnds; p.AppPara.Offday = Day; p.AppPara.Datefrom = DateTime.Now; p.AppPara.Dateto = DateTime.Now; p.AppPara.CityName = "Raipur"; int i = await _communicationservice.CreateAppointments(p); return(RedirectToPage(page)); } else { return(Page()); } }