コード例 #1
0
        public RESERVATION Add(RESERVATION entity)
        {
            RESERVATION insertedReservation = null;

            if (CheckHelper.IsFilled(entity))
            {
                using (ctx = new ReadingRoomsEntities())
                {
                    entity.RES_ID = 1;

                    RESERVATION maxReservation = ctx.RESERVATIONs.OrderByDescending(s => s.RES_ID).FirstOrDefault();
                    if (CheckHelper.IsFilled(maxReservation))
                    {
                        entity.RES_ID = maxReservation.RES_ID + 1;
                    }

                    if (CheckHelper.IsFilled(entity.SEATs))
                    {
                        foreach (SEAT seat in entity.SEATs)
                        {
                            ctx.Entry(seat).State = EntityState.Unchanged;
                        }
                    }

                    insertedReservation = ctx.RESERVATIONs.Add(entity);
                    ctx.SaveChanges();
                }
            }

            return(insertedReservation);
        }
コード例 #2
0
 public void Delete(long id)
 {
     using (ctx = new ReadingRoomsEntities())
     {
         USER entity = ctx.USERs.Where(f => f.USR_ID == id).FirstOrDefault();
         if (CheckHelper.IsFilled(entity))
         {
             ctx.USERs.Remove(entity);
             ctx.SaveChanges();
         }
     }
 }
コード例 #3
0
 public void Delete(long id)
 {
     using (ctx = new ReadingRoomsEntities())
     {
         READING_ROOM entity = ctx.READING_ROOM.Where(f => f.RROOM_ID == id).FirstOrDefault();
         if (CheckHelper.IsFilled(entity))
         {
             ctx.READING_ROOM.Remove(entity);
             ctx.SaveChanges();
         }
     }
 }
コード例 #4
0
 public void Delete(long id)
 {
     using (ctx = new ReadingRoomsEntities())
     {
         UNIVERSITY entity = ctx.UNIVERSITies.Where(u => u.UNI_ID == id).FirstOrDefault();
         if (CheckHelper.IsFilled(entity))
         {
             ctx.UNIVERSITies.Remove(entity);
             ctx.SaveChanges();
         }
     }
 }
コード例 #5
0
 public void Delete(long id)
 {
     using (ctx = new ReadingRoomsEntities())
     {
         RESERVATION entity = ctx.RESERVATIONs.Where(s => s.RES_ID == id).FirstOrDefault();
         if (CheckHelper.IsFilled(entity))
         {
             ctx.RESERVATIONs.Remove(entity);
             ctx.SaveChanges();
         }
     }
 }
コード例 #6
0
        public USER Update(USER entity)
        {
            USER updatedUser = null;

            using (ctx = new ReadingRoomsEntities())
            {
                updatedUser             = ctx.USERs.Attach(entity);
                ctx.Entry(entity).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            return(updatedUser);
        }
コード例 #7
0
        public READING_ROOM Update(READING_ROOM entity)
        {
            READING_ROOM updatedReadingRoom = null;

            using (ctx = new ReadingRoomsEntities())
            {
                updatedReadingRoom      = ctx.READING_ROOM.Attach(entity);
                ctx.Entry(entity).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            return(updatedReadingRoom);
        }
コード例 #8
0
        public SEAT Update(SEAT entity)
        {
            SEAT updatedSeat = null;

            using (ctx = new ReadingRoomsEntities())
            {
                updatedSeat             = ctx.SEATs.Attach(entity);
                ctx.Entry(entity).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            return(updatedSeat);
        }
コード例 #9
0
        public UNIVERSITY Update(UNIVERSITY entity)
        {
            UNIVERSITY updatedUni = null;

            using (ctx = new ReadingRoomsEntities())
            {
                updatedUni = ctx.UNIVERSITies.Attach(entity);
                ctx.Entry(entity).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            return(updatedUni);
        }
コード例 #10
0
        public FACULTY Update(FACULTY entity)
        {
            FACULTY updatedFaculty = null;

            using (ctx = new ReadingRoomsEntities())
            {
                updatedFaculty          = ctx.FACULTies.Attach(entity);
                ctx.Entry(entity).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            return(updatedFaculty);
        }
コード例 #11
0
        public RESERVATION Update(RESERVATION entity)
        {
            RESERVATION updatedReservation = null;

            using (ctx = new ReadingRoomsEntities())
            {
                updatedReservation      = ctx.RESERVATIONs.Attach(entity);
                ctx.Entry(entity).State = EntityState.Modified;
                ctx.SaveChanges();
            }

            return(updatedReservation);
        }
コード例 #12
0
        public USER Add(USER entity)
        {
            USER insertedUser = null;

            if (CheckHelper.IsFilled(entity))
            {
                using (ctx = new ReadingRoomsEntities())
                {
                    entity.USR_ID = 1;

                    USER maxUser = ctx.USERs.OrderByDescending(f => f.USR_ID).FirstOrDefault();
                    if (CheckHelper.IsFilled(maxUser))
                    {
                        entity.USR_ID = maxUser.USR_ID + 1;
                    }

                    insertedUser = ctx.USERs.Add(entity);
                    ctx.SaveChanges();
                }
            }

            return(insertedUser);
        }
コード例 #13
0
        public READING_ROOM Add(READING_ROOM entity)
        {
            READING_ROOM insertedReadingRoom = null;

            if (CheckHelper.IsFilled(entity))
            {
                using (ctx = new ReadingRoomsEntities())
                {
                    entity.RROOM_ID = 1;

                    READING_ROOM maxReadingRoom = ctx.READING_ROOM.OrderByDescending(f => f.RROOM_ID).FirstOrDefault();
                    if (CheckHelper.IsFilled(maxReadingRoom))
                    {
                        entity.RROOM_ID = maxReadingRoom.RROOM_ID + 1;
                    }

                    insertedReadingRoom = ctx.READING_ROOM.Add(entity);
                    ctx.SaveChanges();
                }
            }

            return(insertedReadingRoom);
        }
コード例 #14
0
        public SEAT Add(SEAT entity)
        {
            SEAT insertedSeat = null;

            if (CheckHelper.IsFilled(entity))
            {
                using (ctx = new ReadingRoomsEntities())
                {
                    entity.SEAT_ID = 1;

                    SEAT maxSeat = ctx.SEATs.OrderByDescending(s => s.SEAT_ID).FirstOrDefault();
                    if (CheckHelper.IsFilled(maxSeat))
                    {
                        entity.SEAT_ID = maxSeat.SEAT_ID + 1;
                    }

                    insertedSeat = ctx.SEATs.Add(entity);
                    ctx.SaveChanges();
                }
            }

            return(insertedSeat);
        }
コード例 #15
0
        public UNIVERSITY Add(UNIVERSITY entity)
        {
            UNIVERSITY insertedUni = null;

            if (CheckHelper.IsFilled(entity))
            {
                using (ctx = new ReadingRoomsEntities())
                {
                    entity.UNI_ID = 1;

                    UNIVERSITY maxUni = ctx.UNIVERSITies.OrderByDescending(u => u.UNI_ID).FirstOrDefault();
                    if (CheckHelper.IsFilled(maxUni))
                    {
                        entity.UNI_ID = maxUni.UNI_ID + 1;
                    }

                    insertedUni = ctx.UNIVERSITies.Add(entity);
                    ctx.SaveChanges();
                }
            }

            return(insertedUni);
        }
コード例 #16
0
        public FACULTY Add(FACULTY entity)
        {
            FACULTY insertedFaculty = null;

            if (CheckHelper.IsFilled(entity))
            {
                using (ctx = new ReadingRoomsEntities())
                {
                    entity.FAC_ID = 1;

                    FACULTY maxFaculty = ctx.FACULTies.OrderByDescending(f => f.FAC_ID).FirstOrDefault();
                    if (CheckHelper.IsFilled(maxFaculty))
                    {
                        entity.FAC_ID = maxFaculty.FAC_ID + 1;
                    }

                    insertedFaculty = ctx.FACULTies.Add(entity);
                    ctx.SaveChanges();
                }
            }

            return(insertedFaculty);
        }