Ejemplo n.º 1
0
        public Country Add(Country entity)
        {
            if (entity.Id > 0) return entity;

            context.Country.AddObject(entity);

            try
            {
                context.SaveChanges();
            }
            catch (OptimisticConcurrencyException e)
            {
                //An optimistic concurrency violation has occurred in the data source.
                throw new ConcurrencyException(e.Message);
            }

            return entity;
        }
Ejemplo n.º 2
0
 public Country Update(Country entity)
 {
     return entity;
 }
Ejemplo n.º 3
0
 public void Delete(Country entity)
 {
     context.DeleteObject(entity);
 }
Ejemplo n.º 4
0
        private void FixupCountry(Country previousValue)
        {
            if (previousValue != null && previousValue.Address.Contains(this))
            {
                previousValue.Address.Remove(this);
            }

            if (Country != null)
            {
                if (!Country.Address.Contains(this))
                {
                    Country.Address.Add(this);
                }
                if (Country_id != Country.Id)
                {
                    Country_id = Country.Id;
                }
            }
        }