Ejemplo n.º 1
0
        public void NewBlog(Travelogue travelogue)
        {
            var context = new SiemensDBEntities();

            context.Travelogues.Add(travelogue);
            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void Delete(int tiD)
        {
            var context  = new SiemensDBEntities();
            var selected = context.Travelogues.FirstOrDefault(t => t.TId == tiD);

            if (selected == null)
            {
                throw new Exception("Failed to Delete as no Travel Detail found");
            }
            context.Travelogues.Remove(selected);
            context.SaveChanges();
        }
Ejemplo n.º 3
0
        public void Update(Travelogue travelogue)
        {
            var context  = new SiemensDBEntities();
            var selected = context.Travelogues.FirstOrDefault(t => t.TId == travelogue.TId);

            if (selected == null)
            {
                throw new Exception("Failed to update as no Travel Detail found");
            }
            selected.Destination = travelogue.Destination;
            selected.Details     = travelogue.Details;
            selected.NoOfDays    = travelogue.NoOfDays;
            selected.TravelDate  = travelogue.TravelDate;
            context.SaveChanges();
        }