Example #1
0
 public static Tenant ToDTO(tenant_tbl t)
 {
     return(new Tenant()
     {
         id = t.id,
         first_name = t.first_name,
         last_name = t.last_name,
         floor = t.floor,
         phone = t.phone,
         mail = t.email,
         type = t.type,
         house_num = t.house_num,
         building_id = t.building_id
     });
 }
Example #2
0
        public static UserPermission CheckUserAndPermissions(string password, string name)
        {
            int id = UserDAL.GetByPassword(password, name);

            if (id != -1)
            {
                user_permissions_tbl user   = UserDAL.GetUserPermissions(id);
                tenant_tbl           tenant = TenantDAL.GetById(id);
                return(new UserPermission
                {
                    Id = id,
                    Permission = user?.permission_id ?? -1,
                    BuildingId = tenant?.building_id ?? -1
                });
            }
            return(new UserPermission()
            {
                Id = -1, Permission = -1, BuildingId = -1
            });
        }