Ejemplo n.º 1
0
 public void UpdatePriority(Ticket ticket)
 {
     using (var context = new TicketingContext())
     {
         var dbEntity = context.Tickets.First(t => t.Id == ticket.Id);
         dbEntity.Priority = (int)ticket.Priority;
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        public Entities.Ticket GetBy(Guid id)
        {
            Entities.Ticket result = null;
            using (var context = new TicketingContext())
            {
                var dbEntity = context.Tickets.Include(t => t.Images).FirstOrDefault(t => t.Id == id);
                if (dbEntity != null)
                {
                    result = dbEntity.ToCore();
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public Guid Create(Entities.Ticket ticket)
        {
            var result = Guid.Empty;

            using (var context = new TicketingContext())
            {
                var dbEntity = ticket.FromCore();
                context.Tickets.Add(dbEntity);
                context.SaveChanges();

                result = dbEntity.Id;
            }

            return(result);
        }
Ejemplo n.º 4
0
        public Guid AttachVideo(Entities.Ticket ticket, Entities.Video video)
        {
            var result = Guid.Empty;

            using (var context = new TicketingContext())
            {
                var dbEntity = video.FromCore();
                dbEntity.TicketId = ticket.Id;
                context.Videos.Add(dbEntity);
                context.SaveChanges();

                result   = dbEntity.Id;
                video.Id = dbEntity.Id;
            }

            _storage.StoreVideo(video);

            return(result);
        }
Ejemplo n.º 5
0
        public Guid AttachImage(Entities.Ticket ticket, Entities.Image image)
        {
            var result = Guid.Empty;

            using (var context = new TicketingContext())
            {
                var dbEntity = image.FromCore();
                dbEntity.TicketId = ticket.Id;
                context.Images.Add(dbEntity);
                context.SaveChanges();

                result   = dbEntity.Id;
                image.Id = dbEntity.Id;
            }

            _storage.StoreImage(image);

            return(result);
        }