Exemple #1
0
        public Event Update(Event entity)
        {
            using (var context = new ToplantiTakipContext())
            {
                var _event = context.Events.Include(x => x.EventDocument).FirstOrDefault(d => d.EventId == entity.EventId);

                _event.EventInfo       = entity.EventInfo;
                _event.EventSubject    = entity.EventSubject;
                _event.StartDate       = entity.StartDate;
                _event.EndDate         = entity.EndDate;
                _event.RoomId          = entity.RoomId;
                _event.ReservationDate = entity.ReservationDate;
                _event.ApproveDate     = entity.ApproveDate;
                _event.ApproveUserId   = entity.ApproveUserId;
                _event.UserId          = entity.UserId;
                _event.Status          = entity.Status;
                _event.ThemeColor      = entity.ThemeColor;

                if (entity.EventDocument != null && entity.EventDocument.Count > 0)
                {
                    _event.EventDocument.AddRange(entity.EventDocument);
                }
                // context.Entry(entity.EventDocument).State = EntityState.Added;
                //context.Entry(entity).State = EntityState.Modified;
                context.SaveChanges();
                return(_event);
            }
        }
 public EventDocument Add(EventDocument entity)
 {
     using (var context = new ToplantiTakipContext())
     {
         context.EventDocuments.Add(entity);
         context.SaveChanges();
         return(entity);
     }
 }
 public Department Add(Department entity)
 {
     using (var context = new ToplantiTakipContext())
     {
         context.Departments.Add(entity);
         context.SaveChanges();
         return(entity);
     }
 }
Exemple #4
0
 public Room Add(Room entity)
 {
     using (var context = new ToplantiTakipContext())
     {
         context.Rooms.Add(entity);
         context.SaveChanges();
         return(entity);
     }
 }
 public void Delete(EventDocument entity)
 {
     using (var context = new ToplantiTakipContext())
     {
         var room = context.EventDocuments.Find(entity.EventDocumentId);
         if (room != null)
         {
             context.EventDocuments.Remove(room);
             context.SaveChanges();
         }
     }
 }
 public void Delete(Department entity)
 {
     using (var context = new ToplantiTakipContext())
     {
         var tag = context.Departments.Find(entity.DepartmentId);
         if (tag != null)
         {
             context.Departments.Remove(tag);
             context.SaveChanges();
         }
     }
 }
Exemple #7
0
 public void Delete(Event entity)
 {
     using (var _context = new ToplantiTakipContext())
     {
         var Event = _context.Events.Include(p => p.Room).First(x => x.EventId == entity.EventId);
         if (Event != null)
         {
             _context.Events.Remove(Event);
             _context.SaveChanges();
         }
     }
 }
        public Department Update(Department entity)
        {
            using (var context = new ToplantiTakipContext())
            {
                var tag = context.Departments.FirstOrDefault(d => d.DepartmentId == entity.DepartmentId);
                tag.DepartmentAddress = entity.DepartmentAddress;
                tag.DepartmentInfo    = entity.DepartmentInfo;
                tag.DepartmentStatus  = entity.DepartmentStatus;


                //context.Entry(entity).State = EntityState.Modified;
                context.SaveChanges();
                return(tag);
            }
        }
        public EventDocument Update(EventDocument entity)
        {
            using (var context = new ToplantiTakipContext())
            {
                var room = context.EventDocuments.FirstOrDefault(d => d.EventDocumentId == entity.EventDocumentId);
                room.Document     = entity.Document;
                room.DocumentName = entity.DocumentName;
                room.DocumentType = entity.DocumentType;

                room.EventId = entity.EventId;


                //context.Entry(entity).State = EntityState.Modified;
                context.SaveChanges();
                return(room);
            }
        }
Exemple #10
0
        public Room Update(Room entity)
        {
            using (var context = new ToplantiTakipContext())
            {
                var room = context.Rooms.FirstOrDefault(d => d.RoomId == entity.RoomId);
                room.RoomInfo     = entity.RoomInfo;
                room.RoomName     = entity.RoomName;
                room.RoomStatus   = entity.RoomStatus;
                room.RoomAddress  = entity.RoomAddress;
                room.RoomInfo     = entity.RoomInfo;
                room.RoomCapacity = entity.RoomCapacity;
                room.DepartmentId = entity.DepartmentId;

                if (entity.RoomImage != null && room.RoomImage != entity.RoomImage)
                {
                    room.RoomImage = entity.RoomImage;
                    room.ImageType = entity.ImageType;
                }

                //context.Entry(entity).State = EntityState.Modified;
                context.SaveChanges();
                return(room);
            }
        }