public void Save(Seminar obj)
        {
            if (obj.ID == 0)
            {
                context.Add(obj);
            }
            else
            {
                context.Seminars.Attach(obj).State = EntityState.Modified;
            }

            context.SaveChanges();
            context.Entry(obj).State = EntityState.Detached;
        }
Exemplo n.º 2
0
        public void Save(Person obj)
        {
            obj.Password = obj.IsAdmin ? simpleHash.Compute(obj.Password) : string.Empty;

            if (obj.ID == 0)
            {
                context.Add(obj);
            }
            else
            {
                context.Persons.Attach(obj).State = EntityState.Modified;
            }

            context.SaveChanges();
            context.Entry(obj).State = EntityState.Detached;
        }