示例#1
0
        public async Task <IActionResult> OnPostEditAsync()
        {
            bool check = SessionHelpers.GetObject <bool>(HttpContext.Session, Constant.IsLoggedIn);

            u = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails);
            if (u.Username == "Chachi" && check)
            {
                p.DeitTable.DeitID      = id;
                p.DeitTable.DeitSummary = DietContent;
                p.DeitTable.DietName    = DietName;
                p.DeitTable.DeittypeID  = DietType;
                p.DeitTable.Princing    = DietPrice;
                p.DeitTable.TrialPeriod = DietTrialPeriod;
                int i = await _communicationservice.UpdateDiet(p);

                if (i > 0)
                {
                    return(RedirectToPage(page));
                }
                else
                {
                    return(Page());
                }
            }
            else
            {
                return(RedirectToPage("Index"));
            }
        }
示例#2
0
        public async void OnGet()
        {
            user    = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails);
            Baskets = await _communicationService.GetBaskets(user.UserID);

            SessionHelpers.StoreObject(HttpContext.Session, Constant.Basket, Baskets);
        }
示例#3
0
        public async Task <IActionResult> OnPostEditAppAsync()
        {
            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);
            appparam isenable = SessionHelpers.GetObject <appparam>(HttpContext.Session, Constant.TodaySlots);

            if (check && u.Username == "Chachi" && isenable.Enabled == 0)
            {
                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.UpdateAppointments(p);

                return(RedirectToPage(page));
            }
            else
            {
                return(Page());
            }
        }
示例#4
0
        public async void OnPostBookAsync()
        {
            DietSite.User u = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails);
            if (SessionHelpers.GetObject <bool>(HttpContext.Session, Constant.IsLoggedIn))
            {
                DateTime slot = SessionHelpers.GetObject <DateTime>(HttpContext.Session, Constant.ParticularSlot);
                HttpContext.Session.Remove(Constant.ParticularSlot);
                int i = await _communicationService.CheckSlots(slot);

                if (i == 0)
                {
                    message = "Book";
                    int x = await _communicationService.InsertSlots(u.UserID, slot);
                }
                else
                {
                    message = "Not Available";
                }
            }
            else
            {
                message = "Not Logged in";
            }
            SessionHelpers.StoreObject(HttpContext.Session, Constant.Message, message);
        }
示例#5
0
        public void OnGet(int id)
        {
            CList = SessionHelpers.GetObject <List <DeitTable> >(HttpContext.Session, Constant.AllDeits);
            Deit  = CList.Where(p => p.DeitID == id).FirstOrDefault <DeitTable>();
            User u = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails);

            SessionHelpers.StoreObject(HttpContext.Session, Constant.Diet, Deit);
        }
示例#6
0
 public void OnGet(int ID)
 {
     id   = ID;
     page = SessionHelpers.GetObject <string>(HttpContext.Session, Constant.RedirectPage);
     HttpContext.Session.Remove(Constant.RedirectPage);
     DList = SessionHelpers.GetObject <List <DeitTable> >(HttpContext.Session, Constant.AllDeits);
     Diet  = DList.Where(p => p.DeitID == ID).FirstOrDefault <DeitTable>();
     SessionHelpers.StoreObject(HttpContext.Session, Constant.Diet, Diet);
 }
示例#7
0
        public async void OnGet(int ID)
        {
            HttpContext.Session.Remove(Constant.RedirectPage);
            id    = ID;
            CList = SessionHelpers.GetObject <List <DeitTable> >(HttpContext.Session, Constant.AllDeits);
            Deit  = CList.Where(p => p.DeitID == ID).FirstOrDefault <DeitTable>();
            u     = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails);
            flag  = await _communicationservice.UserSelection(u.UserID, ID);

            SessionHelpers.StoreObject(HttpContext.Session, Constant.Flag, flag);
            SessionHelpers.StoreObject(HttpContext.Session, Constant.Diet, Deit);
        }
示例#8
0
        public IActionResult OnGetWeightLoss()
        {
            bool IsLoggedIn = SessionHelpers.GetObject <bool>(HttpContext.Session, Constant.IsLoggedIn);

            if (IsLoggedIn)
            {
                return(RedirectToPage("WeightLoss"));
            }
            else
            {
                SessionHelpers.StoreObject(HttpContext.Session, Constant.RedirectPage, "Services");
                return(RedirectToPage("Login"));
            }
        }
示例#9
0
        public async Task <IActionResult> OnPostDeleteAsync()
        {
            page = SessionHelpers.GetObject <string>(HttpContext.Session, Constant.RedirectPage);
            HttpContext.Session.Remove(Constant.RedirectPage);
            p.DeitTable.DeitID = id;
            int i = await _communicationservice.DeleteDiet(p);

            if (i > 0)
            {
                return(RedirectToPage(page));
            }
            else
            {
                return(Page());
            }
        }
示例#10
0
        public async Task <IActionResult> OnGetClinical()
        {
            bool IsLoggedIn = SessionHelpers.GetObject <bool>(HttpContext.Session, Constant.IsLoggedIn);

            if (IsLoggedIn)
            {
                ListDeits = await _communicationService.GetAllDeits();

                SessionHelpers.StoreObject(HttpContext.Session, Constant.IsPresent, true);
                SessionHelpers.StoreObject(HttpContext.Session, Constant.AllDeits, ListDeits);
                return(RedirectToPage("Clinical"));
            }
            else
            {
                SessionHelpers.StoreObject(HttpContext.Session, Constant.RedirectPage, "Services");
                return(RedirectToPage("Login"));
            }
        }
        public async Task <IActionResult> Login(Users user, string ReturnUrl)
        {
            if (IsAuthenticated(user))
            {
                List <Claim> claims = new List <Claim>
                {
                    new Claim(ClaimTypes.Name, user.Username),
                    new Claim(ClaimTypes.Expiration, DateTime.UtcNow.AddMinutes(30).ToString()),
                    new Claim(ClaimTypes.Email, user.Username)
                };

                // create identity
                ClaimsIdentity identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);

                // create principal
                ClaimsPrincipal principal = new ClaimsPrincipal(identity);

                // write to cookie
                await HttpContext.SignInAsync(
                    scheme : CookieAuthenticationDefaults.AuthenticationScheme,
                    principal : principal,
                    properties : new AuthenticationProperties
                {
                    //IsPersistent = true, // for 'remember me' feature
                    //ExpiresUtc = DateTime.UtcNow.AddMinutes(1)
                });

                SessionHelpers.SetObject <bool>(HttpContext.Session, "_isLogedin", true);
                if (string.IsNullOrEmpty(ReturnUrl))
                {
                    ReturnUrl = "/Account";
                }
                return(Redirect($"{ReturnUrl}"));
            }
            var count = SessionHelpers.GetObject <int>(HttpContext.Session, "login_failed");

            count += 1;
            SessionHelpers.SetObject <int>(HttpContext.Session, "login_failed", count);

            return(Redirect("/Account/Login"));
        }
示例#12
0
        public async Task <IActionResult> OnPostRegisterAsync()
        {
            User u = SessionHelpers.GetObject <User>(HttpContext.Session, Constant.UserDetails);

            if (HttpContext.Session.Keys.Contains(Constant.RedirectPage))
            {
                await _communicationservice.InsertUserAddress(u.UserID, Add1, Add2, cityid);

                await _communicationservice.InsertUserContact(u.UserID, Mobile, u.Username);

                string page = SessionHelpers.GetObject <string>(HttpContext.Session, Constant.RedirectPage);
                HttpContext.Session.Remove(Constant.RedirectPage);
                return(RedirectToPage(page));
            }
            else
            {
                await _communicationservice.InsertUserAddress(u.UserID, Add1, Add2, cityid);

                await _communicationservice.InsertUserContact(u.UserID, Mobile, u.Username);

                return(RedirectToPage("Index"));
            }
        }
示例#13
0
        public async Task <IActionResult> OnGetSignIn()
        {
            if (await _communicationService.CheckLogin(Username, Password))
            {
                List <User> users = await _communicationService.getuserdetails(Username);

                DietSite.User u = users.Where(p => p.Username == Username).FirstOrDefault <User>();
                SessionHelpers.StoreObject(HttpContext.Session, Constant.IsLoggedIn, true);
                SessionHelpers.StoreObject(HttpContext.Session, Constant.UserDetails, u);
                LoginMessage = "Successfully Logged In";
                if (HttpContext.Session.Keys.Contains(Constant.RedirectPage))
                {
                    string page = SessionHelpers.GetObject <string>(HttpContext.Session, Constant.RedirectPage);
                    HttpContext.Session.Remove(Constant.RedirectPage);
                    return(RedirectToPage(page));
                }
                return(RedirectToPage("Index"));
            }
            else
            {
                LoginMessage = "UserID or Password is incorrect";
                return(Page());
            }
        }
        public IActionResult Login(string ReturnUrl)
        {
            var isLoggedIn = SessionHelpers.GetObject <bool>(HttpContext.Session, "_isLogedin");

            if (isLoggedIn)
            {
                //clear count
                SessionHelpers.SetObject <int>(HttpContext.Session, "login_failed", 0);
                if (string.IsNullOrEmpty(ReturnUrl))
                {
                    ReturnUrl = "/";
                }
                return(Redirect($"{ReturnUrl}"));
            }
            var count = SessionHelpers.GetObject <int>(HttpContext.Session, "login_failed");

            if (count > 3)
            {
                return(View());
                //return acess denied
            }
            ViewBag.ReturnUrl = ReturnUrl;
            return(View());
        }