Example #1
0
        public override void Delete(Guid ID)
        {
            var climb = GetByID(ID);
            var cats  = climb.ClimbTags.ToArray();

            foreach (var cat in cats)
            {
                Ctx.DeleteObject(cat);
            }
            base.Delete(ID);
        }
Example #2
0
        public void DeleteCheckIn(CheckIn checkIn)
        {
            foreach (var l in checkIn.LoggedClimbs.ToArray())
            {
                checkIn.LoggedClimbs.Remove(l); Ctx.DeleteObject(l);
            }
            foreach (var l in checkIn.Media.ToArray())
            {
                checkIn.Media.Remove(l); Ctx.DeleteObject(l);
            }

            Ctx.DeleteObject(checkIn);
            SaveChanges();
        }
Example #3
0
 public Climb UpdateCategories(Climb tEntity, List <int> categories)
 {
     foreach (var c in tEntity.ClimbTags.ToArray())
     {
         tEntity.ClimbTags.Remove(c); Ctx.DeleteObject(c);
     }
     Ctx.DetectChanges();
     SaveChanges();
     foreach (var c in categories)
     {
         tEntity.ClimbTags.Add(new ClimbTag {
             ID = Guid.NewGuid(), ClimbID = tEntity.ID, Category = c
         });
     }
     Ctx.DetectChanges();
     SaveChanges();
     return(tEntity);
 }