Esempio n. 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Contractor).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ContractorExists(Contractor.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["TrainerID"] = new SelectList(_context.Trainer, "ID", "ID");
                return(Page());
            }

            _context.Attach(Plan).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlanExists(Plan.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                ViewData["MembershipID"] = new SelectList(_context.Membership, "ID", "FirstName");
                return(Page());
            }

            _context.Attach(TuckShop).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TuckShopExists(TuckShop.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Esempio n. 4
0
        public IActionResult OnPost()
        {
            Membership = _context.Membership.Find(ChangePlanForm.MemberId);


            if (!ModelState.IsValid)
            {
                return(Page());
            }
            _context.Attach(Membership).State = EntityState.Modified;
            // UPDATE THE MEMBER RETRIEVED FROM THE DATABASE
            Membership.PlanID = ChangePlanForm.PlanID;
            // TELL THE DATABASE TO SAVE WHATEVER CHANGES WE MADE
            _context.SaveChanges();
            return(RedirectToPage("/Memberships/details", new { id = Membership.PlanID }));
        }