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

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

                if (id > 0)
                {
                    return(RedirectToPage("Index"));
                }
                else
                {
                    return(Page());
                }
            }
            else
            {
                return(RedirectToPage("Index"));
            }
        }