Example #1
0
 public void Delete(T entity)
 {
     using (var context = new SocentContext())
     {
         context.Set <T>().Remove(entity);
         context.SaveChanges();
     }
 }
Example #2
0
 public T Create(T entity)
 {
     using (var context = new SocentContext())
     {
         context.Set <T>().Add(entity);
         context.SaveChanges();
         return(entity);
     }
 }
        public LegalEntity Update(LegalEntity entity)
        {
            using (var context = new SocentContext())
            {
                var existEntity = context.LegalEntities.Single(e => e.Id == entity.Id);

                existEntity.AdministratorName = entity.AdministratorName;
                existEntity.ContactPersonName = entity.ContactPersonName;
                existEntity.CUI                       = entity.CUI;
                existEntity.ActivationDate            = entity.ActivationDate;
                existEntity.ActivityDomain            = entity.ActivityDomain;
                existEntity.LegalEntityName           = entity.LegalEntityName;
                existEntity.SocialEnterpriseType      = entity.SocialEnterpriseType;
                existEntity.SocialInterventionDomains = entity.SocialInterventionDomains;
                existEntity.TerritorialOffice         = entity.TerritorialOffice;

                context.SaveChanges();
                return(existEntity);
            }
        }