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

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppointmentRequestExists(AppointmentRequest.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            int type = Convert.ToInt32((Request.Form["ServiceType"]));

            var newAppointmentRequest = new AppointmentRequest
            {
                AppointmentDate = AppointmentRequest.AppointmentDate,
                AppointmentType = (AppointmentType)type,
                ContactEmail    = AppointmentRequest.ContactEmail,
                ContactPhone    = AppointmentRequest.ContactPhone,
                FirstName       = AppointmentRequest.FirstName,
                LastName        = AppointmentRequest.LastName,
                Location        = AppointmentRequest.Location,
                Message         = AppointmentRequest.Message,
                RequestDateTime = DateTime.Now,
                RequestStatus   = RequestStatus.Requested
            };

            GenerateEmail(newAppointmentRequest);

            _context.AppointmentRequests.Add(newAppointmentRequest);
            await _context.SaveChangesAsync();

            return(RedirectToPage("/Index"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            for (int i = 0; i < AppointmentRequests.Count; i++)
            {
                _context.AppointmentRequests.ToArray()[i].RequestStatus = AppointmentRequests[i].RequestStatus;
            }
            await _context.SaveChangesAsync();

            return(RedirectToPage("/Index"));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.AppointmentRequests.Add(AppointmentRequest);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            AppointmentRequest = await _context.AppointmentRequests.FindAsync(id);

            if (AppointmentRequest != null)
            {
                _context.AppointmentRequests.Remove(AppointmentRequest);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }