Пример #1
0
 public BookingModel GetByUser(string user)
 {
     using (var repo = new BookingRepository())
     {
         return GetAllBookings().Find(x => x.Username == user);
     }
 }
Пример #2
0
 public BookingModel GetById(int id)
 {
     using (var repo = new BookingRepository())
     {
         return GetAllBookings().Find(x => x.BookingID == id);
     }
 }
Пример #3
0
 public List<BookingModel> GetAllBookings()
 {
     using (var bookingrepo = new BookingRepository())
     {
         return bookingrepo.GetAll().Select(x => new BookingModel() { BookingID = x.BookingID, Username = x.Username, BranchName = x.BranchName, OptometristName = x.OptometristName, BookedTime = x.BookedTime, BookedDate = x.BookedDate, TotalCost = x.TotalCost, Status = x.Status }).ToList();
     }
 }
Пример #4
0
 public void Dispose(bool disposing)
 {
     using (var repo = new BookingRepository())
     {
         repo.Dispose();
     }
 }
Пример #5
0
 public void Delete(BookingModel bookingModel)
 {
     using (var repo = new BookingRepository())
     {
         var dis = new Booking();
         dis = repo.GetById(bookingModel.BookingID);
         repo.Delete(dis);
     }
 }
Пример #6
0
        public void Update(BookingModel bookingModel)
        {
            using (var repo = new BookingRepository())
            {
                PatientViewModel pa = new PatientViewModel();
                var dis = new Booking();
                dis = repo.GetById(bookingModel.BookingID);
                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.TotalCost = bookingModel.TotalCost;
                    dis.Status = bookingModel.Status;
                }
                repo.Update(dis);

            }
        }