Exemplo n.º 1
0
        public ActionResult Confirm(Booking bookingView, string Status = "Confirmed")
        {
            if (ModelState.IsValid)
            {
                ApplicationDbContext db = new ApplicationDbContext();
                string user = User.Identity.GetUserName();
                List<Patient> lst = db.Patients.ToList().FindAll(r => r.UserName == user);

                foreach (Patient p in lst)
                {
                    string email = p.Email;
                    var mail = new Email();
                    var message = "Hello" + " " + p.FirstName + " " + p.LastName + " " +
                    "This is a notification to inform you that you have made a booking with ZaKhan Optometrists. If This is not you, please contact us itstudents.dut.ac.za/201615";
                    mail.SendEmail(email, message);
                }

                foreach (Patient p in lst)
                {
                    TempData["message"] = string.Format("{0} Your booking was successfully", p.FirstName + " " + p.LastName);
                }

                bookingView.Status = Status;
                db.Entry(bookingView).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Bookings","Booking");

            }
            return View();
        }
Exemplo n.º 2
0
 public void Delete(BookingModel bookingModel)
 {
     using (var repo = new BookingRepository())
     {
         var dis = new Booking();
         dis = repo.GetById(bookingModel.BookingID);
         repo.Delete(dis);
     }
 }
Exemplo n.º 3
0
        public void Insert(BookingModel bookingModel)
        {
            using (var repo = new BookingRepository())
            {
                PatientViewModel pa = new PatientViewModel();
                var dis = new Booking();
                if (true)
                {
                    //dis.BookingID = bookingModel.BookingID;

                    dis.Username = bookingModel.Username;
                    dis.BranchName = bookingModel.BranchName;
                    dis.OptometristName = bookingModel.OptometristName;
                    dis.BookedTime = bookingModel.BookedTime;
                    dis.BookedDate = bookingModel.BookedDate;
                    dis.Status = bookingModel.Status;

                    dis.TotalCost = bookingModel.TotalCost;

                }
                repo.Insert(dis);
            }
        }
Exemplo n.º 4
0
 public void Update(Booking model)
 {
     _bookingRepository.Update(model);
 }
Exemplo n.º 5
0
 public void Insert(Booking model)
 {
     _bookingRepository.Insert(model);
 }
Exemplo n.º 6
0
 public void Delete(Booking model)
 {
     _bookingRepository.Delete(model);
 }