示例#1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            PackageAppointment = await _context.PackageAppointment.FindAsync(id);

            PackageAppointment.AppointmentDate        = null;
            PackageAppointment.AppointmentTime        = null;
            PackageAppointment.BeauticianID           = null;
            _context.Attach(PackageAppointment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
            }
            //Old code to delete
            //if (PackageAppointment != null)
            //{
            //    _context.PackageAppointment.Remove(PackageAppointment);
            //    await _context.SaveChangesAsync();
            //}

            return(Redirect("../Customers/Details?id=" + PackageAppointment.CustomerID));
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

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

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

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

            return(Redirect("../Customers/Details?id=" + Customer.ID));
        }