Ejemplo n.º 1
0
 public Account GetByLogin(string login)
 {
     using (PersianRugContext entityContext = new PersianRugContext())
     {
         return((from a in entityContext.AccountSet
                 where a.LoginEmail == login
                 select a).FirstOrDefault());
     }
 }
Ejemplo n.º 2
0
        protected override Appointment GetEntity(PersianRugContext entityContext, int id)
        {
            var query = (from e in entityContext.AppointmentSet
                         where e.AppointmentId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
        protected override Reservation GetEntity(PersianRugContext entityContext, int id)
        {
            var query = (from e in entityContext.ReservationSet
                         where e.ReservationId == id
                         select e);

            var results = query.FirstOrDefault();

            return(results);
        }
Ejemplo n.º 4
0
        public Appointment GetCurrentAppointmentByTimeSlot(int timeSlotId)
        {
            using (PersianRugContext entityContext = new PersianRugContext())
            {
                var query = from e in entityContext.AppointmentSet
                            where e.TimeSlotId == timeSlotId
                            select e;

                return(query.FirstOrDefault());
            }
        }
        public IEnumerable <Reservation> GetReservationsByAppointmentDate(DateTime appointmentDate)
        {
            using (PersianRugContext entityContext = new PersianRugContext())
            {
                var query = from r in entityContext.ReservationSet
                            where r.BookDate < appointmentDate
                            select r;

                return(query.ToFullyLoaded());
            }
        }
Ejemplo n.º 6
0
        public IEnumerable <Appointment> GetCurrentlyAppointments()
        {
            using (PersianRugContext entityContext = new PersianRugContext())
            {
                var query = from e in entityContext.AppointmentSet
                            where e.AppointmentDate > DateTime.Now && e.AppointmentDate < DateTime.Now.AddDays(7)
                            select e;

                return(query.ToFullyLoaded());
            }
        }
Ejemplo n.º 7
0
        public IEnumerable <Appointment> GetAppointmentHistoryByAccount(int accountId)
        {
            using (PersianRugContext entityContext = new PersianRugContext())
            {
                var query = from e in entityContext.AppointmentSet
                            where e.AccountId == accountId
                            select e;

                return(query.ToFullyLoaded());
            }
        }
        public IEnumerable <CustomerReservationInfo> GetCurrentCustomerReservationInfo()
        {
            using (PersianRugContext entityContext = new PersianRugContext())
            {
                var query = from r in entityContext.ReservationSet
                            join a in entityContext.AccountSet on r.AccountId equals a.AccountId
                            join c in entityContext.TimeSlotSet on r.TimeSlotId equals c.TimeSlotId
                            select new CustomerReservationInfo()
                {
                    Customer    = a,
                    TimeSlot    = c,
                    Reservation = r
                };

                return(query.ToFullyLoaded());
            }
        }
Ejemplo n.º 9
0
 protected override TimeSlot AddEntity(PersianRugContext entityContext, TimeSlot entity)
 {
     return(entityContext.TimeSlotSet.Add(entity));
 }
Ejemplo n.º 10
0
 protected override IEnumerable <TimeSlot> GetEntities(PersianRugContext entityContext)
 {
     return(from e in entityContext.TimeSlotSet
            select e);
 }
 protected override IEnumerable <Reservation> GetEntities(PersianRugContext entityContext)
 {
     return(from e in entityContext.ReservationSet
            select e);
 }
 protected override Reservation UpdateEntity(PersianRugContext entityContext, Reservation entity)
 {
     return((from e in entityContext.ReservationSet
             where e.ReservationId == entity.ReservationId
             select e).FirstOrDefault());
 }
 protected override Reservation AddEntity(PersianRugContext entityContext, Reservation entity)
 {
     return(entityContext.ReservationSet.Add(entity));
 }
Ejemplo n.º 14
0
 protected override TimeSlot UpdateEntity(PersianRugContext entityContext, TimeSlot entity)
 {
     return((from e in entityContext.TimeSlotSet
             where e.TimeSlotId == entity.TimeSlotId
             select e).FirstOrDefault());
 }
Ejemplo n.º 15
0
 protected override Account AddEntity(PersianRugContext entityContext, Account entity)
 {
     return(entityContext.AccountSet.Add(entity));
 }
Ejemplo n.º 16
0
 protected override IEnumerable <Appointment> GetEntities(PersianRugContext entityContext)
 {
     return(from e in entityContext.AppointmentSet
            select e);
 }
Ejemplo n.º 17
0
 protected override Appointment UpdateEntity(PersianRugContext entityContext, Appointment entity)
 {
     return((from e in entityContext.AppointmentSet
             where e.AppointmentId == entity.AppointmentId
             select e).FirstOrDefault());
 }
Ejemplo n.º 18
0
 protected override Appointment AddEntity(PersianRugContext entityContext, Appointment entity)
 {
     return(entityContext.AppointmentSet.Add(entity));
 }