示例#1
0
        public int UpdateTaxProfile(TaxProfileType item)
        {
            int result = 0;

            using (var context = new AgileInvoiceDbContext(_connectionString))
            {
                IQueryable <TaxProfile> lista = from row in context.TaxProfiles
                                                where row.IdTaxProfile == item.IdTaxProfile
                                                select row;
                if (lista.Count() > 0)
                {
                    var entitie = lista.FirstOrDefault();

                    entitie.Name             = item.Name;
                    entitie.Identification   = item.Identification;
                    entitie.Street           = item.Street;
                    entitie.ExteriorNumber   = item.ExteriorNumber;
                    entitie.InteriorNumber   = item.InteriorNumber;
                    entitie.Suburb           = item.Suburb;
                    entitie.Municipality     = item.Municipality;
                    entitie.State            = item.State;
                    entitie.Country          = item.Country;
                    entitie.PostCode         = item.PostCode;
                    entitie.ModificationDate = DateTime.Now;

                    result = context.SaveChanges();
                }
            }
            return(result);
        }
        public int AddUser(UserSignUp entitie)
        {
            int result = 0;

            using (var context = new AgileInvoiceDbContext(connString))
            {
                User item = new User();
                item.Name         = entitie.Name;
                item.Email        = entitie.Email;
                item.Password     = entitie.Password;
                item.CreationDate = DateTime.Now;

                context.Users.Add(item);
                result = context.SaveChanges();
            }
            return(result);
        }
示例#3
0
        public int RemoveTaxProfile(int Id)
        {
            int result = 0;

            using (var context = new AgileInvoiceDbContext(_connectionString))
            {
                //IQueryable<TaxProfile> lista = context.TaxProfiles.Select(item => item.Identification == Identification).ToList();
                IQueryable <TaxProfile> lista = from row in context.TaxProfiles
                                                where row.IdTaxProfile == Id
                                                select row;
                if (lista.Count() > 0)
                {
                    context.TaxProfiles.Remove(lista.FirstOrDefault());
                    result = context.SaveChanges();
                }
            }
            return(result);
        }
示例#4
0
        public int AddTaxProfile(TaxProfileType item)
        {
            int result = 0;

            using (var context = new AgileInvoiceDbContext(_connectionString))
            {
                TaxProfile entitie = new TaxProfile();
                entitie.Name           = item.Name;
                entitie.Identification = item.Identification;
                entitie.Street         = item.Street;
                entitie.ExteriorNumber = item.ExteriorNumber;
                entitie.InteriorNumber = item.InteriorNumber;
                entitie.Suburb         = item.Suburb;
                entitie.Municipality   = item.Municipality;
                entitie.State          = item.State;
                entitie.Country        = item.Country;
                entitie.PostCode       = item.PostCode;
                entitie.CreationDate   = DateTime.Now;

                context.TaxProfiles.Add(entitie);
                result = context.SaveChanges();
            }
            return(result);
        }