Exemple #1
0
        public IActionResult ScheduleAppointment(Appointment ap, int id)
        {
            short  Id      = Convert.ToInt16(id);
            string user_id = HttpContext.Session.GetString("User_Id");

            if (!string.IsNullOrWhiteSpace(user_id))
            {
                short Visitor_Id = Convert.ToInt16(user_id);
                if (ModelState.IsValid)
                {
                    visitorRepository.AddAppointment(ap, Id, Visitor_Id);
                    return(RedirectToAction("Index", "Visitor"));
                }
                else
                {
                    ViewBag.message = "Something went wrong please try again.";
                    return(View());
                }
            }
            else
            {
                return(NotFound());
            }
        }