Example #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());
     }
 }
Example #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);
        }
Example #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());
            }
        }
Example #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());
            }
        }
Example #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());
            }
        }
Example #9
0
 protected override TimeSlot AddEntity(PersianRugContext entityContext, TimeSlot entity)
 {
     return(entityContext.TimeSlotSet.Add(entity));
 }
Example #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));
 }
Example #14
0
 protected override TimeSlot UpdateEntity(PersianRugContext entityContext, TimeSlot entity)
 {
     return((from e in entityContext.TimeSlotSet
             where e.TimeSlotId == entity.TimeSlotId
             select e).FirstOrDefault());
 }
Example #15
0
 protected override Account AddEntity(PersianRugContext entityContext, Account entity)
 {
     return(entityContext.AccountSet.Add(entity));
 }
Example #16
0
 protected override IEnumerable <Appointment> GetEntities(PersianRugContext entityContext)
 {
     return(from e in entityContext.AppointmentSet
            select e);
 }
Example #17
0
 protected override Appointment UpdateEntity(PersianRugContext entityContext, Appointment entity)
 {
     return((from e in entityContext.AppointmentSet
             where e.AppointmentId == entity.AppointmentId
             select e).FirstOrDefault());
 }
Example #18
0
 protected override Appointment AddEntity(PersianRugContext entityContext, Appointment entity)
 {
     return(entityContext.AppointmentSet.Add(entity));
 }