示例#1
0
        public void UnsubscribeRequest(Request request)
        {
            using (var context = new ProgDatabaseEntities())
            {
                try
                {
                    var decisions = from d in context.Decisions
                                    where d.RequestID == request.RequestID
                                    select d;

                    foreach (var decision in decisions)
                    {
                        context.Entry(decision).State = EntityState.Deleted;
                    }

                    context.Entry(request).State = EntityState.Deleted;
                    context.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
示例#2
0
 public void RemoveEditedPerson(Person person)
 {
     using (var context = new ProgDatabaseEntities())
     {
         try
         {
             context.Entry(person).State = EntityState.Deleted;
             context.SaveChanges();
         }
         catch (Exception)
         {
             throw;
         }
     }
 }