コード例 #1
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         repo.Update(UserData);
         repo.Commit();
         return(RedirectToPage("./Index", new { user = UserData.UserName }));
     }
     return(Page());
 }
コード例 #2
0
        public IActionResult OnPost(string user)
        {
            string Mes = repo.Delete(user);

            if (Mes == "Successfull")
            {
                repo.Commit();
                HttpContext.Session.Clear();
                return(RedirectToPage("/Index"));
            }
            return(Page());
        }
コード例 #3
0
        public IActionResult OnPost(int rId)
        {
            string User         = HttpContext.Session.GetString("username");
            var    SingleRecord = repo.GetRecordsById(rId);
            bool   resp         = repo.DeleteRecord(SingleRecord);

            if (resp)
            {
                repo.Commit();
                return(RedirectToPage("./Index", new { user = User }));
            }
            return(Page());
        }
コード例 #4
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         Message = repo.Add(SignupDetails);
         if (Message == "Successfull")
         {
             repo.Commit();
             HttpContext.Session.SetString("username", SignupDetails.UserName);
             return(RedirectToPage("/Dashboard/Index", new { user = SignupDetails.UserName }));
         }
     }
     return(Page());
 }
コード例 #5
0
        public IActionResult OnPost(int mId)
        {
            var Username  = HttpContext.Session.GetString("username");
            var MovieData = repo.GetMoviesById(mId);

            if (string.IsNullOrEmpty(Username))
            {
                return(RedirectToPage("/Login"));
            }
            var newRecord = new Records()
            {
                User       = repo.GetUserByUsername(Username),
                Movies     = MovieData,
                TakenDate  = DateTime.Now,
                ReturnDate = DateTime.Now.AddDays(MovieData.ReturnDays)
            };

            repo.AddRecord(newRecord);
            repo.Commit();
            return(RedirectToPage("/Dashboard/Index", new { user = Username }));
        }