Beispiel #1
0
        //CREATE Tanant
        public void AddTenant(string guid, string firstname, string lastname, string email, string companyId)
        {
            try
            {
                using (var context = new MultiTenantDbEntities())
                {
                    Guid guid_new     = Guid.Parse(guid);
                    Guid guid_company = Guid.Parse(companyId);

                    context.Tenants.Add(new Tenant()
                    {
                        guid       = guid_new,
                        firstname  = firstname,
                        lastname   = lastname,
                        email      = email,
                        LandlordID = guid_company
                    });

                    context.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
        //READ property
        public List <property> getProperties()
        {
            using (var context = new MultiTenantDbEntities())
            {
                var results = from p in context.properties
                              select p;

                return(results.ToList());
            }
        }
Beispiel #3
0
 //CREATE landlord
 public void AddLandlord(string guid, string firstname, string lastname, string profilePicUrl)
 {
     using (var context = new MultiTenantDbEntities())
     {
         Guid guid_new = Guid.Parse(guid);
         context.Landlords.Add(new Landlord()
         {
             guid          = guid_new,
             firstname     = firstname,
             lastname      = lastname,
             profilePicUrl = profilePicUrl
         });
         context.SaveChanges();
     }
 }
Beispiel #4
0
        //CREATE Property
        public void AddCompany(string guid, string name, string email)
        {
            Guid guid_new = Guid.Parse(guid);

            using (var context = new MultiTenantDbEntities())
            {
                context.Companies.Add(new Company()
                {
                    guid  = guid_new,
                    name  = name,
                    email = email
                });
                context.SaveChanges();
            }
        }
Beispiel #5
0
        public List <Tenant> GetUser(string email)
        {
            try
            {
                using (var context = new MultiTenantDbEntities())
                {
                    var result = from t in context.Tenants
                                 where t.email == email
                                 select t;

                    return(result.ToList());
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #6
0
        //CREATE Property
        public void AddProperty(string guid, string street, string city, string postcode, string type, int bedrooms, string parking, string pets, string companyId)
        {
            using (var context = new MultiTenantDbEntities())
            {
                Guid guid_new     = Guid.Parse(guid);
                Guid guid_company = Guid.Parse(companyId);
                context.properties.Add(new property()
                {
                    guid      = guid_new,
                    street    = street,
                    city      = city,
                    postcode  = postcode,
                    type      = type,
                    bedrooms  = bedrooms,
                    parking   = parking,
                    pets      = pets,
                    companyID = guid_company
                });

                context.SaveChanges();
            }
        }